![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构+算法
文章平均质量分 79
Albahaca
这个作者很懒,什么都没留下…
展开
-
树结构
http://www.cnblogs.com/huangxincheng/archive/2012/07/21/2602375.html转载 2013-09-06 14:22:33 · 324 阅读 · 0 评论 -
Sort
Wiki link http://en.wikipedia.org/wiki/Sorting_algorithm1. Bubble Sort : O(n^2) for array两层for循环,交换相邻元素。2. Selection Sort : O(n^2) for array两层for循环,每次找到最小值放在对应的位置,交换。3. Insertion S原创 2013-11-20 15:43:41 · 651 阅读 · 0 评论 -
Implement a queue/stack
Queue:Doubly linked list:#include using namespace std;struct ListNode { int val; ListNode *next, *pre; ListNode(int x) :val(x), next(NULL), pre(NULL) {}};class Queue { private: Lis原创 2014-03-28 02:38:07 · 386 阅读 · 0 评论 -
Algorithms: Design and Analysis, Part 1Problem Set #5
Correct1 / 1 points1. Consider a directed graph with distinct and nonnegative edge lengths and a source svertex. Fix a destination vertex t, and assume that the graph contains原创 2016-09-06 02:21:41 · 1245 阅读 · 0 评论 -
Algorithms: Design and Analysis, Part 1, Programming Assignment #5
import heapqimport sysfname = 'dijkstraData.txt'#fname = "tc.txt"fh = open(fname)lines = [line.rstrip('\n') for line in fh]# Generate graph as a list of dictionaries.# Index of list is the ver原创 2016-09-06 13:55:46 · 651 阅读 · 0 评论