public static void Main(string[] args) { int[] obj1 = Sort.GetIntArray(), obj2 = obj1, obj3 = obj1; Sort s_instance = new Sort(); //选择排序 s_instance.StartTimer(); Sort.MaxSort(obj1); s_instance.StopTimer(); //冒泡排序 s_instance.StartTimer(); Sort.BubbleSort(obj2); s_instance.StopTimer(); //新组排序 s_instance.StartTimer(); Sort.InsertSort(obj3); s_instance.StopTimer(); Console.ReadKey(); Stack <int> s = new Stack <int>(); Queue <int> q = new Queue <int>(); foreach (int i in obj1) { s.Push(i); } foreach (int i in obj1) { q.Enqueue(i); } foreach (int i in s) { Console.WriteLine(i); } Console.ReadKey(); foreach (int i in q) { Console.WriteLine(i); } Console.ReadKey(); LinkedList <int> L = new LinkedList <int>(); foreach (int i in obj1) { L.AddLast(i); } foreach (int i in L) { Console.WriteLine(i); } Console.WriteLine("First:" + L.First.Value); Console.WriteLine("555:" + L.ElementAt(555)); Console.WriteLine("Last:" + L.Last.Value); Console.ReadKey(); }
public void TestBubbleSort() { Sort.BubbleSort(_nums); Print(); }