using System;using System.Collections.Generic;using Chester.DataStructLib;using DataStructLib;namespace DataStruct{class Program{static void Main(string[] args){//TestArray();//TesthashTable();TestLinkedList();}static void TesthashTable(){HashTable<string, int> hashTable = new HashTable<string, int>();hashTable["a"] = 1;hashTable["b"] = 2;hashTable["c"] = 3;hashTable["d"] = 4;hashTable["e"] = 5;hashTable["f"] = 6;hashTable["g"] = 7;hashTable["g"] = 8;hashTable["g"] = 9;hashTable["g"] = 10;Console.WriteLine(hashTable);}static void TestArray(){Comparison<int> comparison = delegate (int a, int b){if (a > b)return 1;else if (a == b)return 0;elsereturn -1;};SortArray<int> sortArray = new SortArray<int>(2);sortArray.Comparer = comparison;//IArray<int> array = new VariableArray<int>(2);IArray<int> array = sortArray;array.Append(10);Console.WriteLine(array);array.Append(22);Console.WriteLine(array);array.Append(32);Console.WriteLine(array);array.Append(4);Console.WriteLine(array);array.Append(51);Console.WriteLine(array);array.Append(6);Console.WriteLine(array);Console.WriteLine(array.IndexOf(4));SortArray<int> sortArray2 = new SortArray<int>(2);sortArray2.Comparer = comparison;sortArray2.Append(100);sortArray2.Append(200);sortArray2.Append(102);sortArray2.Append(300);sortArray2.Append(160);sortArray2.Append(150);Console.WriteLine(sortArray2);sortArray2.Merge(array as SortArray<int>);Console.WriteLine(sortArray2);}static void TestLinkedList(){Comparison<int> comparison = delegate (int a, int b){if (a > b)return 1;else if (a == b)return 0;elsereturn -1;};SingleLinkedList<int> linkedList = new SingleLinkedList<int>();IArray<int> array = linkedList;array.Append(10);Console.WriteLine(array);array.Append(22);Console.WriteLine(array);array.Append(32);Console.WriteLine(array);array.Append(4);Console.WriteLine(array);array.Append(51);Console.WriteLine(array);array.Append(6);Console.WriteLine(array);Console.WriteLine(array.IndexOf(4));Console.WriteLine(array[0]);Console.WriteLine(array[1]);Console.WriteLine(array[2]);Console.WriteLine(array[3]);Console.WriteLine(array[4]);Console.WriteLine(array[5]);Console.WriteLine(array[6]);}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。