随笔分类 -  DataStructure

个人用C#学习数据结构,非完全原创.
递归-斐波那契(母牛生小牛问题)
摘要:题: 若一头小母牛,从出生起第四个年头开始每年生一头母牛,按此规律,第n年有多少头母牛? 阅读全文

posted @ 2008-02-02 18:18 Haozes 阅读(2827) 评论(0) 推荐(0)

递归-八皇后/N皇后问题
摘要:八皇后问题是一个古老而著名的问题,是回溯算法的典型例题。该问题是十九世纪著名的数学家高斯1850年提出:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。 阅读全文

posted @ 2008-02-02 18:18 Haozes 阅读(598) 评论(0) 推荐(0)

递归-裴波那契数列
摘要:裴波那契数列 阅读全文

posted @ 2008-02-02 18:18 Haozes 阅读(503) 评论(0) 推荐(0)

快速排序(C#数据结构学习十)
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyQuickSort{/**////<summary>///快速排序算法///</summary>///快速排序为不稳定排序,时间复杂度O(nlog2n),为同数量级中最快的排序方法///... 阅读全文

posted @ 2007-01-02 18:48 Haozes 阅读(2157) 评论(3) 推荐(0)

冒泡排序(C#数据结构学习九)
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyBubbleSort{//冒泡排序staticvoidBubbleSort(int[]arr){intn=arr.Length;for(inti=0;i<n-1;i++)//做n-1趟排序{boolnos... 阅读全文

posted @ 2007-01-02 18:47 Haozes 阅读(594) 评论(1) 推荐(0)

希尔排序(C#数据结构学习八)
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyShellSort{/**////<summary>///希尔排序///</summary>///<paramname="arr">需要排序的数列</param>... 阅读全文

posted @ 2007-01-01 20:40 Haozes 阅读(968) 评论(0) 推荐(0)

插入排序(C#数据结构学习七)
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyInsertSort{//插入排序//这个简单不多注释staticvoidInsertSort(int[]array){//递增排序inttemp;inti,j,n;n=array.Length;for(i=1... 阅读全文

posted @ 2007-01-01 20:37 Haozes 阅读(677) 评论(0) 推荐(0)

折半查找(C#数据结构学习六)
摘要:1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Text;45namespaceSoloDataStructure6{78publicclassBinschDemo9{10publicstaticintBinsch(int[]a,intkey)11{12intlow=1;13inthigh=a.Length;14while(lo... 阅读全文

posted @ 2006-12-21 19:49 Haozes 阅读(1558) 评论(4) 推荐(0)

[ZT]线索二叉树(C#数据结构五)
摘要:1usingSystem;23namespaceBiThrTree4{5/**////<summary>6///定义结点类:7///</summary>8classBTNode9{10//先序:先处理父结点,然后递归处理孩子11//中序:先处理左孩子,再处理根节结,然后递归处理右孩子12//后序:先递归处理所有孩子,再递归处理节点本点13publicchardata;14p... 阅读全文

posted @ 2006-12-21 19:46 Haozes 阅读(519) 评论(0) 推荐(0)

队列(C#数据结构学习三)
摘要:1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Text;45namespacesoloDataStruct6{7publicclassMyqueue<T>8{9privateintmaxSize;10privateT[]queArray;11privateintfront;12privateintrear;13pr... 阅读全文

posted @ 2006-12-19 14:23 Haozes 阅读(967) 评论(1) 推荐(0)

二叉树(C#数据结构四)
摘要:1usingSystem;2usingSystem.Collections;3usingSystem.Collections.Generic;4usingSystem.Text;56namespacesoloDatastruct7{8publicclassTNode<T>//树结点9{10publicTdata;//结点值11publicTNode<T>left;//左孩子... 阅读全文

posted @ 2006-12-19 14:19 Haozes 阅读(885) 评论(1) 推荐(0)

栈(C#数据结构学习二)
摘要:1usingSystem;2usingSystem.Collections;3usingSystem.Collections.Generic;4usingSystem.Text;56namespacesoloDataStruct7{8publicclassMystack<T>9{10privateT[]stackarray;11privateintmaxSize;12privatein... 阅读全文

posted @ 2006-12-17 17:06 Haozes 阅读(523) 评论(0) 推荐(0)

无聊用C#2.0泛型实现的链表(C#数据结构一)
摘要:1usingSystem;2usingSystem.Collections;3usingSystem.Collections.Generic;4namespaceMyLinkList5{6publicclassLNode<T>//结点7{8privateTdata;//结点值9privateLNode<T>nextNode;10privateLNode<T>pr... 阅读全文

posted @ 2006-12-16 20:38 Haozes 阅读(779) 评论(1) 推荐(0)