
数据结构+算法
文章平均质量分 79
Albahaca
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
树结构
http://www.cnblogs.com/huangxincheng/archive/2012/07/21/2602375.html转载 2013-09-06 14:22:33 · 362 阅读 · 0 评论 -
Sort
Wiki link http://en.wikipedia.org/wiki/Sorting_algorithm 1. 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 · 689 阅读 · 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 · 431 阅读 · 0 评论 -
Algorithms: Design and Analysis, Part 1Problem Set #5
Correct 1 / 1 points 1. 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 · 1314 阅读 · 0 评论 -
Algorithms: Design and Analysis, Part 1, Programming Assignment #5
import heapq import sys fname = '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 · 734 阅读 · 0 评论