
数据结构
文章平均质量分 72
Eden_LZH
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1001. Bacon Number
Description The Bacon number of an actor is the number of degrees of separation he or she has from Bacon. For example, Tom Hanks has a Bacon number 1, because he was in Apollo 13 with Kevin Bacon.原创 2015-01-10 21:39:16 · 743 阅读 · 0 评论 -
1010. bracket matching
Description Implement the following function that decides if a list of brackets match. bool brackets(string s); /* The input s is a list of brackets, including {,},(,),[,], and possibly blanks.原创 2015-01-12 22:08:33 · 587 阅读 · 0 评论 -
1005. 业绩排名
Description 年末公司将职员按照业绩从大到小排序后分配奖金。假定输入是职员姓名以及业绩, 业绩是正整数。 请你按照职员业绩从高到低将职员排序,业绩相同时按照输入先后次序排序。 输出是排序后的名次和职员姓名列表, 业绩相同时,名次相同。 例如,输入: (wang ming, 320), (gao min, 330), (zhang li, 280), (luo yan, 320原创 2015-01-11 21:35:30 · 595 阅读 · 0 评论 -
1002. Is It Acyclic
Description Given a directed graph, decide if it is acyclic (there is no directed cycle). Input There are multiple test cases. The first line contains an integer T, indicating the number of原创 2015-01-11 20:29:43 · 361 阅读 · 0 评论 -
1007. Find the middle element in a Linked List
Description Assuming the following definition: template struct Node { Node_entry entry; Node *next; Node(); Node(Node_entry item, Node *add_on = NULL); }; template Node::Node(原创 2015-01-11 21:51:40 · 594 阅读 · 0 评论 -
1006. Join two lists
Description list join(const list &a, const list &b) //returns a list of distinct integers both in a and b. For example, a = (3,4,3,5); b = (2,3,2,12,4,4), then c = (3,4). or c = (4,3). The ord原创 2015-01-11 21:43:55 · 336 阅读 · 0 评论 -
1004. Hashing
Description Implement the following Hash class using separate chaining. template class HashTable { public: HashTable(int (* h)(HashedObj x), int size = 101 ) : currentSize( 0原创 2015-01-11 20:49:40 · 542 阅读 · 0 评论 -
1003. Width of Binary Trees
Description The maximum number of nodes in all levels in a binary tree is called the width of the tree. For example, the binary tree on the right in the following figure has width 4 because the max原创 2015-01-11 20:41:30 · 649 阅读 · 0 评论 -
1000. Minimum Weight
Description Given a list of weights w1, w2, ..., wn, we can construct a binary tree with n leaves, where each leaf is marked with one weight. The is called a weighted binary tree. The weight of t原创 2015-01-10 21:28:09 · 468 阅读 · 0 评论 -
1011. Find the external path length
Description Given the linked representation of binary trees typedef int T; struct BinaryNode{ T data; //store data BinaryNode *left, *right; BinaryNode(T d, BinaryNode *l=NULL, BinaryNode*原创 2015-01-13 21:02:04 · 582 阅读 · 0 评论