//平时下班自己学习用的
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
namespace DSC1
{
class Program
{
static void Main(string[] args)
{
//Name myName = new Name("wang", "wei", "guo");
//string fullName, inits;
//fullName = myName.ToString();
//inits = myName.Initials();
//Console.WriteLine("My Name is {0}", fullName);
//Console.WriteLine("Init is {0}", inits);
//Console.ReadLine();
//Collection names = new Collection();
//names.Add("David");
//names.Add("bernica");
//foreach(Object name in names)
//{
// Console.WriteLine(name);
//}
//Console.WriteLine("Count : " + names.Count());
//Console.ReadLine();
//int num1 = 100;
//int num2 = 200;
//Swap<int>(ref num1, ref num2);
//Console.WriteLine(num1);
//Console.WriteLine(num2);
//Console.ReadLine();
//int[] nums = new int[10000];
//BuildArray(nums);
//TimeSpan duration;
//Timing2 time2 = new Timing2();
//time2.startTime();
//DisplayNums(nums);
//DisplayNums(nums);
//DisplayNums(nums);
//time2.stopTime();
//Console.WriteLine(time2.Result().TotalSeconds);
duration = Process.GetCurrentProcess().TotalProcessorTime;
Console.WriteLine(duration.TotalSeconds);
//Console.ReadLine();
//int[] numbers;
//numbers = new int[] { 1, 2, 3 };
//Type arrayType = numbers.GetType();
//if(arrayType.IsArray)
//{
// Console.WriteLine("This is a Array");
//}
//else
//{
// Console.WriteLine("This is not a Array");
//}
//Console.ReadLine();
//int[,] grades = new int[,]
//{
// {1,82,74,89,100},
// {2,93,96,85,86}
//};
//int last_grade = grades.GetUpperBound(1);
//double average = 0.0;
//int total;
//int last_student = grades.GetUpperBound(0); //最后一个学生的index
//for(int row=0;row<=last_student;row++)
//{
// total = 0;
// for(int col=1;col<=last_grade;col++)
// {
// total += grades[row, col];
// }
// average = total / last_grade;
// Console.WriteLine(average);
//}
//ArrayList names = new ArrayList();
//names.Add("Mike");
//names.Add("Beata");
//Console.WriteLine("The Original list of names: ");
//foreach(Object name in names)
//{
// Console.Write(name + " ");
//}
//string[] newNames = new string[] { "David", "Michael" };
//ArrayList moreNames = new ArrayList();
//moreNames.Add("wwg");
//names.InsertRange(0, newNames);
//names.AddRange(moreNames);
//foreach (Object name in names)
//{
// Console.Write(name + " ");
//}
//CArray nums = new CArray(10);
//Random rnd = new Random(100);
//for (int i = 0; i < 10;i++ )
//{
// nums.Insert(rnd.Next(0,100));
//}
//nums.DisplayElements();
//nums.SelectionSort();
//Timing2 sortTime = new Timing2();
//Random rnd = new Random(10000);
//int numItems = 10000;
//CArray theArray = new CArray(numItems);
//for (int i = 0; i < numItems;i++ )
//{
// theArray.Insert(rnd.Next(0,10000));
//}
//sortTime.startTime();
//theArray.SelectionSort();
//sortTime.stopTime();
//Console.WriteLine("SelectionSort : " + sortTime.Result().TotalMilliseconds);
//theArray.Clear();
//for (int i = 0; i < numItems; i++)
//{
// theArray.Insert((int)(rnd.NextDouble() * 100));
//}
//sortTime.startTime();
//theArray.BubbleSort();
//sortTime.stopTime();
//Console.WriteLine("BubbleSort : " + sortTime.Result().TotalMilliseconds);
//theArray.Clear();
//int[] numbers = new int[100];
//StreamReader numFile = File.OpenText(@"d:/wwgData/numbers.txt");
//for (int i = 0; i < numbers.Length; i++)
//{
// numbers[i] = Convert.ToInt32(numFile.ReadLine(), 10);
//}
//int searchNumber;
//Console.Write("Enter a number to search for: ");
//searchNumber = Convert.ToInt32(Console.ReadLine(), 10);
//bool found;
//found = SeqSearch(numbers, searchNumber);
//Random random = new Random();
//CArray mynums = new CArray(10);
//for (int i = 0; i <= 9; i++)
//{
// mynums.Insert(random.Next(10));
//}
//mynums.BubbleSort();
//mynums.DisplayElements();
//int position = mynums.binSearch(7);
//if (position>-1)
//{
// Console.WriteLine("found it");
//}
//else
//{
// Console.WriteLine("not found it");
//}
回文
//CStack alist = new CStack();
//string ch;
//string word = "sees";
//bool ishui = true;
//for (int x = 0; x < word.Length;x++ )
//{
// alist.push(word.Substring(x, 1));
//}
//int pos = 0;
//while(alist.count>0)
//{
// ch = alist.pop().ToString(); //出栈,是最后一个字母
// if(ch != word.Substring(pos,1))
// {//不是回文
// ishui = false;
// break;
// }
// pos++;
//}
//if (ishui)
//{
// Console.WriteLine("is hui");
//}
//else
//{
// Console.WriteLine("no hui");
//}
//使用Stack完成表达式计算
//Stack nums = new Stack();
//Stack ops = new Stack();
//string expression = "1 + 2 + 3 + 5";
//Calculate(nums, ops, expression);
//Console.WriteLine(nums.Pop());
//int num, baseNum;
//num = Convert.ToInt32(Console.ReadLine());
//baseNum = Convert.ToInt32(Console.ReadLine());
//MulBase(num, baseNum);
//Queue[] numQueue = new Queue[10];//用于收集用的
//int[] nums = new int[] { 91, 46, 85, 15, 92, 35, 31, 22 };
//for (int i = 0; i < 10;i++ )
//{
// numQueue[i] = new Queue();
//}
先各位发散
//RSort(numQueue, nums, DigitType.ones);
收集
//BuildArray(numQueue, nums);
十位发散
//RSort(numQueue, nums, DigitType.tens);
收集
//BuildArray(numQueue, nums);
//DisplayNums(nums);
//byte[] ByteSet = new Byte[] { 2};
//BitArray BitSet = new BitArray(ByteSet);
//for (int bits = 0; bits <= BitSet.Count - 1; bits++)
//{
// Console.Write(BitSet.Get(bits) + "");
//}
//int bits;
//string[] binNumber = new string[8];
//byte[] ByteSet = new Byte[] { 5 };
//BitArray BitSet = new BitArray(ByteSet);
//bits = 0;
//int binary = 7;
//for (int i = 0; i < BitSet.Count - 1;i++ )
//{
// if(BitSet.Get(i)== true)
// {
// binNumber[binary] = "1";
// }
// else
// {
// binNumber[binary] = "0";
// }
// bits++;
// binary--;
// if((bits% 8)==0)
// {
// binary = 7;
// bits = 0;
// for(int j=0;j<=7;j++)
// {
// Console.Write(binNumber[j]);
// }
// }
//}
//string string1 = "Hello world";
//int len = string1.Length;
//int pos = string1.IndexOf(" ");
//string firstWord, secondWord;
//firstWord = string1.Substring(0, pos);
//secondWord = string1.Substring(pos + 1);
//Console.Write(firstWord);
//Console.Write(",");
//Console.Write(secondWord);
//string astring = "now is a happy day";
//ArrayList words = new ArrayList();
//words = SplitWords(astring);
//foreach (string word in words)
//{
// Console.Write(word + ",");
//}
//string data = "Mike,McMillan,wwg,smm";
//string[] sdata;
//char[] delimiter = new char[] { ',' };
//sdata = data.Split(delimiter, data.Length);
//foreach(string word in sdata)
//{
// Console.Write(word + " ");
//}
//string[] nouns = new string[] { "cat", "dog", "bird", "eggs", "bones" };
//ArrayList pluralNouns = new ArrayList();
//foreach(string noun in nouns)
//{
// if(noun.EndsWith("s"))
// {
// }
//}
//string[] words = new string[] { "recieve", "decieve", "reciept" };
//for (int i = 0; i <= words.GetUpperBound(0);i++ )
//{
// words[i] = words[i].Replace("cie", "cei");
// Console.WriteLine(words[i]);
//}
//string[,] names = new string[,]
//{
// {"1504","wwg","Ella","steve","Bob"},
// {"1133","Elizabeth","Alex","David","Joe"}
//};
//for (int outer=0;outer<=names.GetUpperBound(0);outer++)
//{
// for (int inner=0;inner<=names.GetUpperBound(1);inner++)
// {
// Console.Write(names[outer,inner].PadRight(10)+" ");
// }
// Console.WriteLine();
//}
//string[] names = new string[] { " David", " Raymond", "Mike " };
//showName(names);
//StringBuilder stBuff = new StringBuilder("Ken Thompson");
//Console.WriteLine(stBuff.Length.ToString());
//Console.WriteLine(stBuff.Capacity.ToString());
//Console.WriteLine(stBuff.MaxCapacity.ToString());
//StringBuilder stBuff = new StringBuilder();
//Console.WriteLine();
//stBuff.AppendFormat("YOU order is for {0} widges ", 234);
//Console.WriteLine(stBuff.ToString());
//StringBuilder stBuff = new StringBuilder("noise in+++++string");
//stBuff.Remove(9, 5);
//Console.WriteLine(stBuff);
//int size = 100000;
//Timing2 timeSB = new Timing2();
//Timing2 timeST = new Timing2();
//for (int i = 0; i <= 0;i++ )
//{
// timeSB.startTime();
// BuildSB(size);
// timeSB.stopTime();
// timeST.startTime();
// BuildString(size);
// timeST.stopTime();
// Console.WriteLine("sb size;" + size + ",time:" + timeSB.Result().TotalMilliseconds);
// Console.WriteLine("st size;" + size + ",time:" + timeST.Result().TotalMilliseconds);
//}
//string words = "08/14/57 46 02/25/59 45 06/05/85 18 08/14/57 46";
//string regExp1 = "(?<dates>(//d{2}///d{2}///d{2}))//s(?<ages>(//d{2}))//s";
//MatchCollection matchSet = Regex.Matches(words, regExp1);
//int matchPos;
//if (matchSet.Count > 0)
//{
// foreach (Match aMatch in matchSet)
// {
// foreach (Capture aCapture in aMatch.Groups["dates"].Captures)
// {
// Console.WriteLine("date:" + aCapture.ToString());
// }
// foreach (Capture aCapture2 in aMatch.Groups["ages"].Captures)
// {
// Console.WriteLine("age:" + aCapture2.ToString());
// }
// }
//}
//string[] words = new string[] { "heal", "heel", "noah", "techno"};
//string regExp = "h$"; //. 与字符串中任意字符匹配
//MatchCollection aMatch;
//foreach (string word in words)
//{
// if (Regex.IsMatch(word, regExp))
// {
// aMatch = Regex.Matches(word, regExp);
// for (int i = 0; i < aMatch.Count; i++)
// {
// Console.Write(aMatch[i].Value + " ");
// }
// }
//}
//IPAddress myIPs = new IPAddress();
//myIPs.Add("Mike", "192.111.111.0");
//myIPs.Add("wwg", "120.0.0.1");
//Console.WriteLine(myIPs.Count);
//Console.WriteLine(myIPs.Item("wwg"));
//myIPs.Clear();
//Console.WriteLine(myIPs.Count);
//IPAddress myips = new IPAddress(@"D://data.txt");
//Console.WriteLine(myips.Count);
//Console.WriteLine(myips.Item("wwg"));
//KeyValuePair<string, int>[] gradeBook = new KeyValuePair<string, int>[10];
//gradeBook[0] = new KeyValuePair<string, int>("McMillan", 99);
//gradeBook[1] = new KeyValuePair<string, int>("Ruff", 64);
//for (int i = 0; i <= gradeBook.GetUpperBound(0);i++ )
//{
// Console.WriteLine(gradeBook[i].Key + ":" + gradeBook[i].Value);
//}
//string[] names = new string[99];
//string name;
//string[] someNames = new string[] { "David", "Jennifer", "Donnie", "Mayno","Raymod","Bernica","Clayton","Beata","Michael","wwg" };
//int hashVal;
//for (int i = 0; i < 10;i++ )
// name = someNames[i];
// hashVal = BetterHash(name, names);
// names[hashVal] = name;
//}
//ShowDistrib(names);
//Hashtable symbols = new Hashtable(25);
//symbols.Add("salary", 100000);
//symbols.Add("name", "David Durr");
//symbols.Add("age", 45);
//symbols.Add("dept", "IT");
//symbols["sex"] = "Male";
//Console.WriteLine("The keys are: ");
//foreach (Object key in symbols.Keys)
//{
// Console.Write(key + ",");
//}
//Console.WriteLine();
//foreach (object key in symbols.Keys)
//{
// Console.WriteLine(key.ToString()+":"+symbols[key].ToString());
//}
//LinkList MyList = new LinkList();
//ListIter iter = new ListIter(MyList);
//string choice, value;
//try
//{
// iter.insertAfter("David");
// iter.insertAfter("Mike");
// iter.InsertBefore("Donnie");
// while(true)
// {
// Console.WriteLine("Enter your choice");
// choice = Console.ReadLine().ToLower();
// char[] onechar = choice.ToCharArray();
// switch (onechar[0])
// {
// case 'n':
// if((!MyList.IsEmpty())&&(!iter.AtEnd()))
//