随笔分类 -  Algorithm

Algorithm
单链表操作相关算法
摘要:整理一些面试当中经常遇到的问题 帮助自己记忆.链表的类型: 单向链表,双向链表,循环链表C++ 链表的例子typedef struct IntElement { struct IntElement *next; int data;} IntElement;c# 实现 public class LinkNode { public LinkNode Next; public object Data;}操作链表常犯的错误:C#public void insertInFront( LinkNode list, Object data){ LinkNode temp = new LinkNode(); 阅读全文
posted @ 2010-11-09 00:34 stone 阅读(347) 评论(0) 推荐(0)
Get depth of BTree
摘要:public int GetDepth(BTreeNode node){ if(node == null) return 0; else { int d1=GetDepth(node.LNode); int d2=GetDepth(node.RNode); } return d1>d2?d1++:d2++; } 阅读全文
posted @ 2008-07-02 09:47 stone 阅读(228) 评论(0) 推荐(0)
Quick sort C# code(2)
摘要:public class QuickSortNonRecursion{ public int Split(int[] data,int low,int high) { if(data == null) throw new ArgumentNullException(); if(low<0 || high >= data.length) throw new ArgumentOutOfR... 阅读全文
posted @ 2008-07-01 10:45 stone 阅读(328) 评论(0) 推荐(0)
Quick sort C# code
摘要:public class IntQuickSort{private static int Split(int[] data,int low,int high) {if(data == null) throw new ArgumentException(); if(low<0 || high >= data.length) throw new ArgumentOutOfRangeExce... 阅读全文
posted @ 2008-06-30 11:16 stone