Skip List, C#实现
温习下数据结构, C#版的Skip List实现
Skip List
namespace Ln.SkipList
{
/// <summary>
/// the values of list is ascend.
/// </summary>
public class SkipList
{
private SkipNode head;
private System.Random randomFa = new System.Random();
public SkipList(){}
/// <summary>
/// Initialize skip list
/// </summary>
/// <returns></returns>
public bool Init()
{
head = new SkipNode(0, null, null);
return true;
}
/// <summary>
/// Clean skip list
/// </summary>
/// <returns></returns>
public bool Clear()
{
head = null;
return true;
}
/// <summary>
/// Insert value to skip list
/// </summary>
/// <param name="value"></param>
/// <returns>if the value exists in the list already, return false.</returns>
public bool Insert(int value)
{
 
{
/// <summary>
/// the values of list is ascend.
/// </summary>
public class SkipList
{
private SkipNode head;
private System.Random randomFa = new System.Random();
public SkipList(){}
/// <summary>
/// Initialize skip list
/// </summary>
/// <returns></returns>
public bool Init()
{
head = new SkipNode(0, null, null);
return true;
}
/// <summary>
/// Clean skip list
/// </summary>
/// <returns></returns>
public bool Clear()
{
head = null;
return true;
}
/// <summary>
/// Insert value to skip list
/// </summary>
/// <param name="value"></param>
/// <returns>if the value exists in the list already, return false.</returns>
public bool Insert(int value)
{
 
补充:软件开发 , C# ,
上一个:SQLServer中批量插入数据方式的性能对比
下一个:C#中英文混合朗读
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,
部份技术文章来自网络,