- 博客(4)
- 收藏
- 关注
原创 C++ 链表实现构造Huffman树
浙江大学的教材《数据结构》第146页上的用堆构建哈夫曼链表树的函数的实现 1. 函数结构与书中代码相同。堆中元素为指向哈夫曼树的节点的指针:struct HuffmanTree { int weight; HuffmanTree* left; HuffmanTree* right; }; struct MinHeap { HuffmanTree** da
2015-04-29 00:07:52 1021
原创 04-树5. Complete Binary Search Tree (30)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than the node's key. The righ
2015-04-11 23:48:23 442
原创 时间效率O(N)的排序
功能:给定一堆数,已知所有数都不是-1,用O(N)时间对它们进行排序。 int main(void) { int n = 0; int* tempInput = (int*) malloc(sizeof(int) * MAXSIZE); // 所有元素全部置-1 for (int i = 0; i < MAXSIZE; i++) {
2015-04-11 16:21:22 431
原创 02-线性结构2. Reversing Linked List (25)
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, if K = 3, then you must output 3→2→1→6→5→4; if K
2015-04-07 23:25:15 1636
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人