algorithms icon indicating copy to clipboard operation
algorithms copied to clipboard

《剑指Offer》、LeetCode

Results 3 algorithms issues
Sort by recently updated
recently updated
newest added

for example, this printer will print binary tree of [0,-10,5,null,-3,null,9] as: 0 / \ / \ -10 5 \ \ -3 9

题目:输入两棵二叉树 A 和 B,判断 B 是不是 A 的子结构。 【解1】: * 利用二叉树的神级遍历(空间复杂度:O(1), 时间复杂度:O(h)) * 转化成字符串匹配问题:KMP算法(时间:O(N)) * 总的时间复杂度:O(N) 看起来是一种解 有bug 如果通过先序遍历不能够确定一个树把。就是说加入两棵树结构不一样,也能返回相同字符串吧。

1. # 插入排序算法 2. 3. 4. public static int[] Selection_Sort(int[] a) { 5. 6. int N = a.length; 7. int min = 0; 8. for (int i = 0; i...