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 ...
随机推荐
- CentOS6.10 Nginx无法解析php文件
一 .问题描述: 1). 前提: nginx 已经安装完毕,并且能够访问 2). 问题: 当访问 .php 文件时会默认下载,或者提示 “File not found.” 3). 本机环境 PHP 版 ...
- kali 安装google输入法
脑子一热装了一礼拜的kali,在20多遍的重装后终于成功了 先码一篇如何安装google输入法 首先得更新源,用leafpad /etc/apt/sources.list打开,或vi也可以,更新源百度 ...
- library 中的internal power为何为负值?
下图是library中一个寄存器Q pin 的internal_power table, 表中该pin 的internal power 大多都是负值.其实library 中的internal_powe ...
- 条件锁condition与Queue()
在学习之前你应该先了解锁和队列基础 import queue import time import random import threading import asyncio import logg ...
- Java:不得不知的Object类
目录 一.equals 1.equals与==有啥区别? 2.equals方法的规范 3.instanceof 和getClass() 4.其他总结 二.hashCode 1.hashCode的规范 ...
- sqlmap使用教程(超详细)
-u 指定目标URL (可以是http协议也可以是https协议) -d 连接数据库 --dbs 列出所有的数据库 --current-db 列出当前数据库 --tables 列出当前的表 --col ...
- 密码学笔记——eval(function(p,a,c,k,e,d) 加密破解
密码学笔记——eval(function(p,a,c,k,e,d) 的加密破解 例题: 小明某天在看js的时候,突然看到了这么一段代码,发现怎么也理不出代码逻辑,你能帮帮他吗? 格式:SimCTF{} ...
- XSS 1
首先打开链接https://xss.haozi.me/ 点击打开第一题 然后看一下代码 尝试一下用简单的代码 可不可以通过 例如:<script>alert(1)</script& ...
- C 语言实例 - 判断三边能否构成三角形
原理: 要判断输入的三条边能否够成三角形,只需满足条件两边之和大于第三边即可. #include<stdio.h> int main() { printf("请输入三个边长:\n ...
- jvm字节码助记符
反编译指令 javap -c xxxx.class JVM参数设置 -xx:+<option> 开启option -xx: -<option> ...