57.布隆过滤器

Bloom Filter

一个很长的二进制向量和一个映射函数

布隆过滤器可以用于检索一个元素是否存在一个集合中

优点是空间效率和查询效率远超一般算法,缺点是有一定的误识别率和删除困难


30.有效括号生成:leetcode22

problem

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.


26.广度优先&深度优先

20190918005018.png


21.递归和分治:leetcode-50

Implement pow(x, n).

eg. 2^2 = 2^1 * 2^1 = (2^0 * 2^0 * 2) * (2^0 * 2^0 * 2) = (1 * 1 * 2) * (1 * 1 * 2) = 4

eg. 2^3 = 2^1 * 2^1 * 2 = (2^0 * 2^0 * 2) * (2^0 * 2^0 * 2) * 2 = (1 * 1 * 2) * (1 * 1 * 2) * 2 = 8


20.二叉树的遍历


19.二叉搜索树_最近公共祖先:leetcode235

problem

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.

According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).”


19.二叉树_最近公共祖先:leetcode236

problem

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.

According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).”


18.验证二叉搜索树:leetcode-98 Search Tree

problem

Given a binary tree, determine if it is a valid binary search tree (BST).

Assume a BST is defined as follows:

The left subtree of a node contains only nodes with keys less than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
Both the left and right subtrees must also be binary search trees.


17.树和图

树是特殊化的链表


哈希表

HashTable & Hash Function & Collisions


HashMap,HashSet,TreeMap,TreeSet

hashtable vs binary-serch-tree

但是二叉搜索树相对有序

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×