个人用C#学习数据结构,非完全原创.
摘要:题:
若一头小母牛,从出生起第四个年头开始每年生一头母牛,按此规律,第n年有多少头母牛?
阅读全文
摘要:八皇后问题是一个古老而著名的问题,是回溯算法的典型例题。该问题是十九世纪著名的数学家高斯1850年提出:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。
阅读全文
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyQuickSort{/**////<summary>///快速排序算法///</summary>///快速排序为不稳定排序,时间复杂度O(nlog2n),为同数量级中最快的排序方法///...
阅读全文
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyBubbleSort{//冒泡排序staticvoidBubbleSort(int[]arr){intn=arr.Length;for(inti=0;i<n-1;i++)//做n-1趟排序{boolnos...
阅读全文
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyShellSort{/**////<summary>///希尔排序///</summary>///<paramname="arr">需要排序的数列</param>...
阅读全文
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceSoloDataStructure{classMyInsertSort{//插入排序//这个简单不多注释staticvoidInsertSort(int[]array){//递增排序inttemp;inti,j,n;n=array.Length;for(i=1...
阅读全文
摘要:1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Text;45namespaceSoloDataStructure6{78publicclassBinschDemo9{10publicstaticintBinsch(int[]a,intkey)11{12intlow=1;13inthigh=a.Length;14while(lo...
阅读全文
摘要:1usingSystem;23namespaceBiThrTree4{5/**////<summary>6///定义结点类:7///</summary>8classBTNode9{10//先序:先处理父结点,然后递归处理孩子11//中序:先处理左孩子,再处理根节结,然后递归处理右孩子12//后序:先递归处理所有孩子,再递归处理节点本点13publicchardata;14p...
阅读全文
摘要:1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Text;45namespacesoloDataStruct6{7publicclassMyqueue<T>8{9privateintmaxSize;10privateT[]queArray;11privateintfront;12privateintrear;13pr...
阅读全文
摘要:1usingSystem;2usingSystem.Collections;3usingSystem.Collections.Generic;4usingSystem.Text;56namespacesoloDatastruct7{8publicclassTNode<T>//树结点9{10publicTdata;//结点值11publicTNode<T>left;//左孩子...
阅读全文
摘要:1usingSystem;2usingSystem.Collections;3usingSystem.Collections.Generic;4usingSystem.Text;56namespacesoloDataStruct7{8publicclassMystack<T>9{10privateT[]stackarray;11privateintmaxSize;12privatein...
阅读全文
摘要:1usingSystem;2usingSystem.Collections;3usingSystem.Collections.Generic;4namespaceMyLinkList5{6publicclassLNode<T>//结点7{8privateTdata;//结点值9privateLNode<T>nextNode;10privateLNode<T>pr...
阅读全文