algorithm
__grail__
这个作者很懒,什么都没留下…
展开
-
Sorted
题: 有两个排好序的int数组A、B;A数组有效长度m;B数组有效长度n; 假设A数组可以容纳B数组的所有元素, 试着把B数组合并到A数组形成一个新的排好序的数组。 // 时间复杂度O(m+n),空间复杂度O(1) void mergeTwoSortedIntegerArrays(int A[], int m, int B[], int n) { int原创 2015-02-09 17:05:22 · 302 阅读 · 0 评论 -
C++二叉树遍历递归与栈循环的实现
// BinaryTreeTraversal.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include using namespace std; struct TreeNode { int val; TreeNode *left;原创 2015-01-20 17:44:15 · 1201 阅读 · 0 评论