数据结构
文章平均质量分 72
Eden_LZH
这个作者很懒,什么都没留下…
展开
-
1001. Bacon Number
DescriptionThe 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 · 690 阅读 · 0 评论 -
1010. bracket matching
DescriptionImplement 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 · 563 阅读 · 0 评论 -
1005. 业绩排名
Description年末公司将职员按照业绩从大到小排序后分配奖金。假定输入是职员姓名以及业绩, 业绩是正整数。请你按照职员业绩从高到低将职员排序,业绩相同时按照输入先后次序排序。输出是排序后的名次和职员姓名列表, 业绩相同时,名次相同。例如,输入: (wang ming, 320), (gao min, 330), (zhang li, 280), (luo yan, 320原创 2015-01-11 21:35:30 · 557 阅读 · 0 评论 -
1002. Is It Acyclic
DescriptionGiven a directed graph, decide if it is acyclic (there is no directed cycle).InputThere are multiple test cases. The first line contains an integer T, indicating the number of原创 2015-01-11 20:29:43 · 340 阅读 · 0 评论 -
1007. Find the middle element in a Linked List
DescriptionAssuming 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 · 564 阅读 · 0 评论 -
1006. Join two lists
Descriptionlist 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 · 310 阅读 · 0 评论 -
1004. Hashing
DescriptionImplement 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 · 523 阅读 · 0 评论 -
1003. Width of Binary Trees
DescriptionThe 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 · 614 阅读 · 0 评论 -
1000. Minimum Weight
DescriptionGiven 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 · 447 阅读 · 0 评论 -
1011. Find the external path length
DescriptionGiven the linked representation of binary treestypedef int T;struct BinaryNode{T data; //store data BinaryNode *left, *right;BinaryNode(T d, BinaryNode *l=NULL, BinaryNode*原创 2015-01-13 21:02:04 · 556 阅读 · 0 评论