正在加载图片...
定义被查找的顺序表中每个记录的类型如下: struct RecType ∥记录类型 public int key;/存放关键字,假设关鍵字为int类型 public string data;/存放其他数据,假设为 Istring类型 定义一个顺序表查找类 SqlistSearch class如下 class salistsearchClass const int MaxSize=100; 顺序表中最多元素个数 public ectype r; 顺序表 public int length; 存放顺序表的长度 public ldxTypell I; /索引表 BTNode ra /拆半查找判定树根结点 string sstr /用于返回结果 public sqlistsearchClasso/构造函数,用于查找顺序表的初始化 i rnew BTNodeo; R=new RecType MaxSize]; I=new IdxType MaxSize]; length=0 /顺序表的基本运算算法和查找算法定义被查找的顺序表中每个记录的类型如下: struct RecType //记录类型 { public int key; //存放关键字,假设关键字为int类型 public string data; //存放其他数据,假设为string类型 }; 定义一个顺序表查找类SqListSearchClass如下 : class SqListSearchClass { const int MaxSize=100; //顺序表中最多元素个数 public RecType[] R; //顺序表 public int length; //存放顺序表的长度 public IdxType[] I; //索引表 BTNode r; //拆半查找判定树根结点 string sstr; //用于返回结果 public SqListSearchClass() //构造函数,用于查找顺序表的初始化 { r=new BTNode(); R=new RecType[MaxSize]; I=new IdxType[MaxSize]; length=0; } //顺序表的基本运算算法和查找算法 }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有