- 博客(8)
- 资源 (4)
- 收藏
- 关注
原创 Populating Next Right Pointers in Each Node
void connect(TreeLinkNode *root) { if( root == NULL || root->left == NULL && root->right == NULL ) //{} \ {0} { return; } TreeLinkNode *p, *q; p = root->left; q
2014-07-18 01:15:16
402
原创 Unique Binary Search Tree
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1
2014-07-12 23:15:07
1400
原创 计数排序 Counting Sort
#include #include static int length;void Counting_Sort( int *A, int *B, int k ){ int *C; C = new int[ k+1 ]; std::cout << " test 10 " << std::endl; for( int i = 0; i <= k; ++i ) { C[i] =
2014-06-24 11:14:07
406
原创 快排 quicksort
#include #include #include int randBetween( int low, int high ) {// int direction = (rand()%2 == 0) ? -1:1; return ((rand() % (high - low)) + low);}void exchange( int &elem1, int &elem2 ){
2014-06-22 22:06:32
484
原创 优先级队列 priority queue
#include #include static int length;static int Heap_Size;inline int Left( int &i ){ return 2*i;}inline int Right( int &i ){ return 2*i+1;}inline int Parent( int &i ){ return floor(i/
2014-06-22 18:43:45
450
原创 堆排 heapsort
堆数据结构是一种数组对象,它可以被视为一棵完全二叉树。表示堆的数组A是一个两个属性的对象:length[A]是数组中的元素个数,heap-size[A]是存放在A中的堆的元素个数,heap-size[A]<=length[A]。树的根为A[1],给定了某个节点的下标i,其父结点Parent(i)、左儿子Left(i)和右儿子Right(i)的下标可以简单的计算出来: Parent(i)
2014-06-18 12:54:52
564
转载 数据库操作语句(SQL)
一、基础1、说明:创建数据库CREATE DATABASE database-name 2、说明:删除数据库drop database dbname3、说明:备份sql server--- 创建 备份数据的 deviceUSE masterEXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNw
2013-05-19 09:27:53
980
转载 POJ题目整理
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:
2013-05-08 16:54:09
627
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人