02 2015 档案

摘要:Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social n... 阅读全文
posted @ 2015-02-27 15:48 糙哥 阅读(269) 评论(0) 推荐(0)
摘要:“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图6.4所示。图6.4 六度空间示意图“六度空间”理论虽然得到广泛的认同,并... 阅读全文
posted @ 2015-02-15 10:14 糙哥 阅读(1920) 评论(0) 推荐(0)
摘要:This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of d... 阅读全文
posted @ 2015-02-12 20:08 糙哥 阅读(776) 评论(0) 推荐(0)
摘要:For a given undirected graph with N vertices and E edges, please list all the connected components by both DFS and BFS. Assume that all the vertices a... 阅读全文
posted @ 2015-02-12 19:27 糙哥 阅读(1273) 评论(0) 推荐(0)
摘要:In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in the history o... 阅读全文
posted @ 2015-02-11 17:02 糙哥 阅读(4719) 评论(3) 推荐(1)
摘要:We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another... 阅读全文
posted @ 2015-02-11 16:06 糙哥 阅读(1614) 评论(0) 推荐(0)
摘要:An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any... 阅读全文
posted @ 2015-02-11 15:08 糙哥 阅读(2866) 评论(3) 推荐(1)
摘要:An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the... 阅读全文
posted @ 2015-02-09 14:17 糙哥 阅读(4772) 评论(3) 推荐(0)
摘要:Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specification:Each input file contains one tes... 阅读全文
posted @ 2015-02-08 20:14 糙哥 阅读(3703) 评论(1) 推荐(0)
摘要:二分法求函数根的原理为:如果连续函数f(x)在区间[a, b]的两个端点取值异号,即f(a)f(b) 2 #include 3 #include 4 using namespace std; 5 6 float f( float x); 7 float a3, a2, a1, a0; 8 9... 阅读全文
posted @ 2015-02-08 20:03 糙哥 阅读(1614) 评论(0) 推荐(0)
摘要:/*多项式加法运算使用链表实现*/#include using namespace std;//使用不带头结点的单向链表,按照指数递减的顺序排列typedef struct PolyNode{ int coef; //系数 int expon; //指数 PolyNod... 阅读全文
posted @ 2015-02-05 18:13 糙哥 阅读(3934) 评论(0) 推荐(0)
摘要:#include using namespace std;#define MAXSIZE 100/*链表的数组实现*/typedef struct{ int listData[MAXSIZE]; int last;}List, *pList;pList CreateEmptyList()... 阅读全文
posted @ 2015-02-05 15:27 糙哥 阅读(682) 评论(0) 推荐(0)
摘要:#include using namespace std;/***********************************//*栈的链式存储结构实际上是一个单链表,叫链栈插入和删除操作只能在链栈的栈顶进行*//***********************************/#defi... 阅读全文
posted @ 2015-02-05 15:26 糙哥 阅读(188) 评论(0) 推荐(0)
摘要:#include using namespace std;/***********************************//*栈的链式存储结构实际上是一个单链表,叫链栈插入和删除操作只能在链栈的栈顶进行*//***********************************/#defi... 阅读全文
posted @ 2015-02-05 15:26 糙哥 阅读(4760) 评论(0) 推荐(0)
摘要:给出一个数组a[]与数组长度N,求该数组中最大子列和。(子列由数组中连续的元素组成)int MaxSubseqSum1(int a[], int N) //O(n^3){ int MaxSum = 0; for (int i = 0; i MaxSum ) ... 阅读全文
posted @ 2015-02-04 21:00 糙哥 阅读(385) 评论(0) 推荐(0)
摘要:设计函数求一元多项式的导数。输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是0,但是表示为“0 0”。输入样例... 阅读全文
posted @ 2015-02-03 22:11 糙哥 阅读(2043) 评论(1) 推荐(1)
摘要:Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6,... 阅读全文
posted @ 2015-02-03 21:48 糙哥 阅读(682) 评论(0) 推荐(0)