- 博客(4)
- 收藏
- 关注
原创 Leetcode 94 —— Binary Tree Inorder Traversal
中序遍历二叉树 1 非递归,使用栈 /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {}
2015-01-05 14:23:42
246
原创 各种排序算法
今天总结一下各种排序算法: N=10000的int数组. 1 插入排序 void insert_sort(int data[], int n) { for(int i = 1; i < n; ++i) { int key = data[i]; int j = i-1; while( j >= 0 && data[j] > key ) {
2014-11-26 00:14:39
250
原创 Map按照Value值排序
map test_map; test_map["b"] = 2; test_map["c"] = 1; test_map["a"] = 3; vector > sort_map(test_map.begin(), test_map.end()); sort(sort_map.begin(), sort_map.end(), sortByMapValue);
2014-08-21 20:00:25
474
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人