文章分类 -  C#算法与数据结构

数据结构与算法(C#实现)系列---二叉树
摘要:using System; using System.Collections; namespace DataStructure { /// /// BinaryTree 的摘要说明。 /// public class BinaryTree:NaryTree { //构造二叉空树 public Binary... 阅读全文
posted @ 2008-07-26 16:39 恩恩爸爸 阅读(224) 评论(0) 推荐(0)
数据结构与算法(C#实现)系列---二叉堆(数组实现)
摘要:using System; using System.Collections; namespace DataStructure { /// /// BinaryHeap 的摘要说明。-------二叉堆(基于数组的实现) /// public class BinaryHeap:IPriorityQueue { protec... 阅读全文
posted @ 2008-07-26 16:38 恩恩爸爸 阅读(327) 评论(0) 推荐(0)
C#冒泡算法
摘要:作者:zzy2740 来自:网络 参加多次笔试,居然有几次都考到了冒泡算法,一次是C#版的填空,一次是javascript版的全部写出。 虽然每次都凭着我对冒泡法的理解给弄出来的,但是多多少少与标准模式有点差别,在网上搜了一下关于C#版的冒泡算法,居然也没有一个象样的,自己对照算法模式认真写了一个C#版的,已经测试... 阅读全文
posted @ 2008-07-26 16:37 恩恩爸爸 阅读(225) 评论(0) 推荐(0)
快速排序
摘要:Author:solarsoft From:Internet 前面我已经推出了三种排序的算法,比较简单。今天我又写了快速排序的算法。希望多多指教。具体的思想,我不做答了。前人的经验。 using System; namespace QuickSorter { public class QuickSorter { private voi... 阅读全文
posted @ 2008-07-26 16:35 恩恩爸爸 阅读(177) 评论(0) 推荐(0)
希尔排序
摘要:Author:solarsoft From:Internet 朋友们,我最近加紧写C#的一些算法。选择排序,插入算法是我已经推出的。现推出希尔排序.今后,如有时间我将依次推出其它的算法编写。 希尔排序是将组分段,进行插入排序. 对想提高C#语言编程能力的朋友,我们可以互相探讨一下。 如:下面的程序,并没有实现多态,来,帮它实现一下。using System; pu... 阅读全文
posted @ 2008-07-26 16:34 恩恩爸爸 阅读(166) 评论(0) 推荐(0)
插入排序
摘要:Author:solarsoft From:Internet 朋友们,我最近加紧写C#的一些算法。选择排序已经推出的。现推出插入算法。 对想提高C#语言编程能力的朋友,我们可以互相探讨一下。 如:下面的程序,并没有实现多态,来,帮它实现一下。 using System; public class InsertionSorter { public void ... 阅读全文
posted @ 2008-07-26 16:34 恩恩爸爸 阅读(139) 评论(0) 推荐(0)
选择排序
摘要:Author:solarsoft From:Internet 嗨!朋友们,C#将是未来网络开发的首选语言。本人用了C#开发出选择排序算法。希望能为C#语言的学习者带来一些益处。 不要忘了,学语言要花大力气学数据结构和算法。 using System; public class SelectionSorter { // public enu... 阅读全文
posted @ 2008-07-26 16:33 恩恩爸爸 阅读(142) 评论(0) 推荐(0)
冒泡排序
摘要:作者:unknown 来自:网络 冒泡排序 本人用了C#开发出冒泡排序算法。希望能为C#语言的学习者带来一些益处。不要忘了,学语言要花大力气学数据结构和算法。 using System; namespace BubbleSorter { public class BubbleSorter { public void Sort(int [] list) { int... 阅读全文
posted @ 2008-07-26 16:32 恩恩爸爸 阅读(174) 评论(0) 推荐(0)
八皇后问题的C#解答
摘要:改编自v星[视窗王子]应答程序,如下: using System; class Queen{ const int SIZE = 8;//皇后数 public static void Main() { int[] Queen = new int [SIZE];//每行皇后的位置 int y,x,i,j,d,t=0; y = 0; Queen[0] = -1; while( true ) { f... 阅读全文
posted @ 2008-07-26 16:30 恩恩爸爸 阅读(214) 评论(0) 推荐(0)
随机排列算法
摘要:花了一根烟的时间写了一个随机排列算法,测了一下,效果好象还不错,嘻嘻,没详细测过。好象有很复杂的算法,高手路过贴给我看看。 using System; using System.Text; namespace RandomRang { /// /// RandomRange 的摘要说明。 /// public class RandomRange { private int r... 阅读全文
posted @ 2008-07-26 16:29 恩恩爸爸 阅读(557) 评论(0) 推荐(0)
Using Linked List in C#
摘要:What we going to make is a linked list. Yeah I know there is a class which does the same as a linked list called ArrayList, but we (as a diehard C# programmer) want absolute control and knowledge of w... 阅读全文
posted @ 2008-07-26 16:26 恩恩爸爸 阅读(510) 评论(0) 推荐(0)
c# Stack 栈的实现
摘要:c# 中 Stack 栈的实现 from MSDN C# Language Specification using System; public class Stack { private Node first = null; public bool Empty { get { return (first == null); } } ... 阅读全文
posted @ 2008-07-26 16:24 恩恩爸爸 阅读(844) 评论(0) 推荐(0)
100位数相乘.
摘要:今天朋友给我出了一道题,说是怎么实现100位数字相乘? 据说这是微创的面试题目. 花了一个晚上终于弄出来一个实现方式.实现了加、减、乘、除. 其中以除的效率最低,暂时还没想到更好的办法.等想到了在更新吧. 算算前后花了大约6、7个小时,如果在面试中碰见这种题目那可如何是好啊. 把代码贴出来,有兴趣的可以看看,大家讨论下是否有更好的实现方法. 以下为代码: /* * Description:超长整型... 阅读全文
posted @ 2008-07-26 16:23 恩恩爸爸 阅读(449) 评论(0) 推荐(0)