leetcode 0205
700 二叉搜索树中的搜索
https://leetcode-cn.com/problems/search-in-a-binary-search-tree

175 组合两个表
表1: Person
+-------------+---------+
| 列名 | 类型 |
+-------------+---------+
| PersonId | int |
| FirstName | varchar |
| LastName | varchar |
+-------------+---------+
PersonId 是上表主键
表2: Address
+-------------+---------+
| 列名 | 类型 |
+-------------+---------+
| AddressId | int |
| PersonId | int |
| City | varchar |
| State | varchar |
+-------------+---------+
AddressId 是上表主键
编写一个 SQL 查询,满足条件:无论 person 是否有地址信息,都需要基于上述两表提供 person 的以下信息:FirstName, LastName, City, State
仍旧不理解 left join
select FirstName, LastName, City, State
from Person left join Address
on Person.PersonId = Address.PersonId;
590. N叉树的后序遍历
递归:

这个思路还是 递归的,下面是迭代的提升:
迭代:
思路: 迭代进行了 NRL 的先序 迭代 遍历,然后reverse NRL 到 LRN 就是 要求的后序遍历了啊。ok

589 N叉树的前序遍历
https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal
递归, 注意 递归 过程中附带的 action 的位置
位置在前面,因为是先序(对比上面的后序遍历, 你可以看到后序遍历的 ans.add(root.val) 在后面。

迭代实现,如何正确入栈(倒序children 入栈,才是先序的正确姿势)

为什么先/前序遍历需要 用 stack ,而不是 queue(以及阐明:层序遍历确实需要queue)



leetcode 0205的更多相关文章
- 我为什么要写LeetCode的博客?
# 增强学习成果 有一个研究成果,在学习中传授他人知识和讨论是最高效的做法,而看书则是最低效的做法(具体研究成果没找到地址).我写LeetCode博客主要目的是增强学习成果.当然,我也想出名,然而不知 ...
- LeetCode All in One 题目讲解汇总(持续更新中...)
终于将LeetCode的免费题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~ 477 Total Hamming Distance ...
- [LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串
Find the length of the longest substring T of a given string (consists of lowercase letters only) su ...
- Leetcode 笔记 113 - Path Sum II
题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...
- Leetcode 笔记 112 - Path Sum
题目链接:Path Sum | LeetCode OJ Given a binary tree and a sum, determine if the tree has a root-to-leaf ...
- Leetcode 笔记 110 - Balanced Binary Tree
题目链接:Balanced Binary Tree | LeetCode OJ Given a binary tree, determine if it is height-balanced. For ...
- Leetcode 笔记 100 - Same Tree
题目链接:Same Tree | LeetCode OJ Given two binary trees, write a function to check if they are equal or ...
- Leetcode 笔记 99 - Recover Binary Search Tree
题目链接:Recover Binary Search Tree | LeetCode OJ Two elements of a binary search tree (BST) are swapped ...
- Leetcode 笔记 98 - Validate Binary Search Tree
题目链接:Validate Binary Search Tree | LeetCode OJ Given a binary tree, determine if it is a valid binar ...
随机推荐
- 【游记】CSP-J2019谔谔记
结果果然不能把希望寄托在渺茫的玄学上,实力不够还是不要渴求什么奇迹了. ----2020.2.21记 Day -6 考场就在我市,所以东道主应该运气会好一点吧. Day -1 听说本来准备上的中学准备 ...
- 13.56Mhz下50欧姆阻抗匹配简易教程
阻抗匹配(impedance matching) 主要用于传输线上,以此来达到所有高频的微波信号均能传递至负载点的目的,而且几乎不会有信号反射回来源点,从而提升能源效益.信号源内阻与所接传输线的特性阻 ...
- ASP.NET Core Web API 控制器与方法返回输出
DATA ACCESS LAYER 在一些不同的示例教程中,我们可能看到 DAL 的实现在主项目中,并且每个控制器中都有实例.我们不建议这么做. 当我们编写 DAL 时,我们应该将其作为一个独立的服务 ...
- js加密(三)企名片
1. url: https://www.qimingpian.cn/finosda/project/pinvestment 2. target: 3. 简单分析 3.1 打开调试窗口,刷新页面,看看都 ...
- kotori和bangdream
#include<cstdio> #include<iostream> using namespace std; int n,x,a,b; int main() { cin ...
- Nuxt的默认模板和默认布局
Nuxt为我们提供了超简单的默认模版订制方法,只要在根目录下创建一个app.html就可以实现了 注:建立了默认模板后,记得要重启服务器,否则你的显示不会成功 默认布局主要针对于页面的统一布局使用.它 ...
- snowflake 雪花算法 分布式实现全局id生成
snowflake是Twitter开源的分布式ID生成算法,结果是一个long型的ID. 这种方案大致来说是一种以划分命名空间(UUID也算,由于比较常见,所以单独分析)来生成ID的一种算法,这种方案 ...
- 502,csssprite是什么,有什么优缺点
(百科:csssprite是一种网页图片应用处理方式,国内常叫css精灵.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢慢 ...
- Linux - curl 基本使用
1. 概述 我接触过的很多服务端调试, 接口测试, 最终都落到了这个地方 简答介绍 curl 的使用 尽量循序渐进, 因为我也不太熟悉 大概会提到的命令 curl curl -v curl -s cu ...
- 【音乐欣赏】《In The End》 - Taska Black / Aviella
曲名:In The End 作者:Taska Black .Aviella [00:00.00] 作曲 : Joachim Gorrebeeck/Aviella Winder [00:11.48]La ...