diff --git a/CompleteInfo.md b/CompleteInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..cb4c5d87f771cfdf6b6ac9854b71cdf9f1e02468 --- /dev/null +++ b/CompleteInfo.md @@ -0,0 +1,28 @@ +## 完成情况 + +1. 用数组实现栈 +2. 用带尾指针的链表实现栈 +3. 用数组实现队列 +4. 用链表实现队列 +5. 实现循环队列 +6. 用栈解决迷宫问题(可能还有一点bug) +7. 后缀表达式计算 +8. 使用栈模拟一个浏览器的前进、后退功能 + +## 文件详细 + +├─QueryAndStack +| ├─Calculation.cs 计算表达式 +| ├─CircleQueue.cs 循环队列 +| ├─Direction.cs 方位枚举 +| ├─ExpansionArray.cs 数组扩容 +| ├─Maze.cs 迷宫 +| ├─MyLinkQueue.cs 单链表队列 +| ├─MyQueue.cs 数组队列 +| ├─Node.cs 队列节点 +| ├─Program.cs 主入口 +| ├─QueryAndStack.csproj +| ├─Stack.cs 栈 +| ├─StackLinkList.cs 链表队列 +| ├─SuffixExpression.cs 后缀表达式 +| diff --git a/QueryAndStack/.vs/QueryAndStack/DesignTimeBuild/.dtbcache.v2 b/QueryAndStack/.vs/QueryAndStack/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000000000000000000000000000000000000..ff2ff21a27d76de666b12baebcedc723c1af7e6e Binary files /dev/null and b/QueryAndStack/.vs/QueryAndStack/DesignTimeBuild/.dtbcache.v2 differ diff --git a/QueryAndStack/.vs/QueryAndStack/v16/.suo b/QueryAndStack/.vs/QueryAndStack/v16/.suo new file mode 100644 index 0000000000000000000000000000000000000000..d1e9b69ed2ca3a1ee5157ce1cbaa8a307b9b9c55 Binary files /dev/null and b/QueryAndStack/.vs/QueryAndStack/v16/.suo differ diff --git a/QueryAndStack/QueryAndStack.sln b/QueryAndStack/QueryAndStack.sln new file mode 100644 index 0000000000000000000000000000000000000000..298381f82527ba9ae2d414405f3aa1499fed5eab --- /dev/null +++ b/QueryAndStack/QueryAndStack.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30611.23 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryAndStack", "QueryAndStack\QueryAndStack.csproj", "{DECD552E-0487-4FF0-A1F6-B3050A67721A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DECD552E-0487-4FF0-A1F6-B3050A67721A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DECD552E-0487-4FF0-A1F6-B3050A67721A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DECD552E-0487-4FF0-A1F6-B3050A67721A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DECD552E-0487-4FF0-A1F6-B3050A67721A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9BAA8BC8-92E3-4706-8333-E7B89782DD03} + EndGlobalSection +EndGlobal diff --git a/QueryAndStack/QueryAndStack/Calculation.cs b/QueryAndStack/QueryAndStack/Calculation.cs new file mode 100644 index 0000000000000000000000000000000000000000..27ef6f1814ca586b80c559cbb6e153764d35b33d --- /dev/null +++ b/QueryAndStack/QueryAndStack/Calculation.cs @@ -0,0 +1,238 @@ +using System; +namespace QueryAndStack +{ + public class Calculation + { + private string expre; + private Stack Opnumber = null; + private Stack opre = null; + public string Expre + { + get + { + return expre; + } + set + { + expre = value; + } + } + + + private static int judgeOP(char c) //判断字符优先级 + { + if (c == '+' || c == '-') + return 1; + else if (c == '*' || c == '/') + return 2; + else + return -1; + } + + + public void showOpNumber() //输出操作数(测试) + { + + decimal[] res = new decimal[20]; + + res = this.Opnumber.arr; + + for (int i = 0; i < res.Length; i++) + { + Console.Write(res[i] + " " + "{0}", i == res.Length - 1 ? "\n" : ""); + } + + // Console.WriteLine(); + + char[] res1 = new char[20]; + res1 = this.opre.arr; + + for (int i = 0; i < res1.Length; i++) + { + Console.Write(res1[i] + " " + "{0}", i == res.Length - 1 ? "\n" : ""); + } + //Console.WriteLine(); + } + + + public void finallyCaculate() + { + while (this.opre.arr.Length > 0) //将符号栈里面所有的符号 全部出栈计算 + { + decimal temp = caculate(this.opre.Pop(), this.Opnumber.Pop(), this.Opnumber.Pop()); + // Console.WriteLine("压栈:" + temp); + this.Opnumber.Push(temp); + } + //给出结果 + + while (this.Opnumber.arr.Length != 0) + { + Console.WriteLine(this.Opnumber.Pop()); + } + } + + + private static decimal caculate(char c, decimal number1, decimal number2) //计算 + { + // Console.WriteLine(number2 + "" + c + " " + number1); + if (c == '+') + { + + return number2 + number1; + } + else if (c == '-') + { + + return number2 - number1; + } + else if (c == '*') + { + + return number2 * number1; + } + else if (c == '/') + { + if (number1 == 0) + { + Console.WriteLine("除数为0,错误"); + } + return number2 / number1; + } + else + { + Console.WriteLine("运算符错误"); + return decimal.MinValue; + } + } + + + //检测表达式 + private static bool expreDetec(Calculation this1) //传参一个对象 + { + + for (int i = 0; i < this1.expre.Length; i++) + { + if (!detecNumber(this1.expre[i]) && + this1.expre[i] != '(' && this1.expre[i] != ')' && + this1.expre[i] != '+' && this1.expre[i] != '-' && + this1.expre[i] != '*' && this1.expre[i] != '/' + ) + { + Console.WriteLine("表达式错误1"); + return false; + } + } + return true; //表达式ok + } + + + //检测是不是全是数字 + private static bool detecNumber(char c) + { + if ((c <= '9' && c >= '0') || c == '.') + { + return true; + } + + else + return false; + } + + + //一直出符号栈 直到遇到左括号 + private static void stackOpUntilLeft(Calculation this1) + { + + while (this1.opre.Peek() != '(') + { + decimal temp = caculate(this1.opre.Pop(), this1.Opnumber.Pop(), this1.Opnumber.Pop());//弹出两个数 计算入number栈 并让计算函数 入栈Opnumber + // Console.WriteLine("压栈:" + temp); + this1.Opnumber.Push(temp); //将计算结果压榨 + } + this1.opre.Pop();//弹出左括号 + } + + + + //数字栈 入栈 () + private static int stackPushNumber(Calculation this1, int i) //对象, 入栈符号 + { + string temp = ""; + for (; i < this1.expre.Length && detecNumber(this1.expre[i]); i++) + { + + temp += this1.expre[i]; + } + this1.Opnumber.Push(decimal.Parse(temp)); + i--; + return i; + // return i -- 错误写法 + } + + + //入栈符号 + private static void stackPushOpre(Calculation this1, char ex, int i) + { + if (ex == '(') //左括号直接入栈 + { + this1.opre.Push(ex); + + if (this1.expre[i + 1] == '-') + { + this1.Opnumber.Push(0); //如果复数((-1)) 这样的话要加个0 抵消-符号 + } + } + else if (ex == ')') //右括号 出符号栈 直到遇到左括号 + { + stackOpUntilLeft(this1); + + } + else //运算符号 + { + if ((this1.opre.Count > 0) && (judgeOP(this1.opre.Peek()) >= judgeOP(ex))) + { + decimal temp = caculate(this1.opre.Pop(), this1.Opnumber.Pop(), this1.Opnumber.Pop()); + this1.Opnumber.Push(temp); //计算结果压栈 + this1.opre.Push(ex);//新的运算符压栈 + } + else + { + this1.opre.Push(ex); //栈顶优先级低于或者等于当前运算符 直接压入符号栈 或者运算符栈为空 + } + } + } + + + public bool GetPostFixExpression() + { + + if (expreDetec(this)) //表达式ok + { + for (int i = 0; i < expre.Length; i++) + { + + if (this.expre[0] == '-' && i == 0) //如果第一个是数字 压栈0 到数字栈(不然会多出一个-号) + { + this.Opnumber.Push(0); + } + if (detecNumber(expre[i])) //数字 + { + + i = stackPushNumber(this, i); //返回i的值 + } + else //如果是 符号 + { + stackPushOpre(this, expre[i], i); + } + } + return true; + } + else //表达式检测错误的 + { + return false; + } + } + + + } +} diff --git a/QueryAndStack/QueryAndStack/CircleQueue.cs b/QueryAndStack/QueryAndStack/CircleQueue.cs new file mode 100644 index 0000000000000000000000000000000000000000..4d5eebe6099f8e3d068cb8b58d83b5c250d10549 --- /dev/null +++ b/QueryAndStack/QueryAndStack/CircleQueue.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class CircleQueue + { + /// + /// 队列数组 + /// + private T[] MyQueue; + /// + /// 队首索引 + /// + private int Head { get; set; } + /// + /// 队尾索引 + /// + private int Tail { get; set; } + public int Size { get; set; } + private int Count { get; set; } + private bool IsEmpty { get { return this.Count == 0; } } + /// + /// 构造函数 + /// + /// + public CircleQueue(int size) + { + this.Size = size; + MyQueue = new T[size]; + //初始化队尾队首 + this.Head = this.Tail = 0; + } + /// + /// 入队 + /// + /// + public void Push(T item) + { + //判断队满 + if (Count == Size) + { + Console.WriteLine("队满,开始扩容"); + ResizeCapacity(MyQueue.Length * 2); + } + GetNextTail(); + MyQueue[Tail] = item; + } + /// + /// 出队 + /// + /// + public T Pop() + { + if (IsEmpty) + { + Console.WriteLine("队列空空如也~"); + return default(T); + } + else + { + var temp = MyQueue[Head]; + GetNextHead(); + return temp; + } + } + /// + /// 遍历输出 + /// + public void Print() + { + foreach (var item in MyQueue) + { + Console.Write(item + "==>"); + } + Console.WriteLine(); + } + /// + /// 获取队尾元素 + /// + /// + public T GetTail() + { + if (IsEmpty) + { + Console.WriteLine("队列为空"); + throw new ArgumentOutOfRangeException("队列为空"); + } + return MyQueue[Tail]; + } + /// + /// 获取队首元素 + /// + /// + public T GetHead() + { + if (IsEmpty) + { + Console.WriteLine("队列为空"); + throw new ArgumentNullException("队列为空"); + } + else + { + return MyQueue[Head]; + } + } + /// + /// 扩充队列 + /// 重构出去 + /// + /// + public void ResizeCapacity(int newCapacity) + { + T[] newItems = new T[newCapacity]; + int index = 0; + if (newCapacity > MyQueue.Length) + { + for (int i = 0; i < MyQueue.Length; i++) + newItems[index++] = MyQueue[i]; + } + else + { + for (int i = 0; i < MyQueue.Length; i++) + { + if (!MyQueue[i].Equals(default(T))) + { + newItems[index++] = MyQueue[i]; + } + } + Head = Tail = 0; + } + MyQueue = newItems; + } + /// + ///获取Head得下一个位置 + /// + /// + public int GetNextHead() + { + if (this.Head + 1 == this.Size) + { + return 0; + } + else + { + return ++Head; + } + } + /// + /// 获取Tail得下一个位置 + /// + /// + public int GetNextTail() + { + if (this.Tail + 1 == this.Size) + { + return 0; + } + else + { + return ++Tail; + } + } + } +} + diff --git a/QueryAndStack/QueryAndStack/Direction.cs b/QueryAndStack/QueryAndStack/Direction.cs new file mode 100644 index 0000000000000000000000000000000000000000..024fe40b7a98186b4e94c03f33a55ea2d1c6aa65 --- /dev/null +++ b/QueryAndStack/QueryAndStack/Direction.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public enum Direction + { + East, + West, + South, + North + } +} diff --git a/QueryAndStack/QueryAndStack/ExpansionArray.cs b/QueryAndStack/QueryAndStack/ExpansionArray.cs new file mode 100644 index 0000000000000000000000000000000000000000..e3a20ac39dd4c8fee222ad39bc9abcb5c0f3ec2b --- /dev/null +++ b/QueryAndStack/QueryAndStack/ExpansionArray.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class ExpansionArray + { + public static void ResizeCapacity(int newCapacity,ref T[] Queues,ref int Head,ref int Tail) + { + + T[] newItems = new T[newCapacity]; + int index = 0; + if (newCapacity > Queues.Length) + { + for (int i = 0; i < Queues.Length; i++) + newItems[index++] = Queues[i]; + } + else + { + for (int i = 0; i < Queues.Length; i++) + { + if (!Queues[i].Equals(default(T))) + { + newItems[index++] = Queues[i]; + } + } + Head = Tail = 0; + } + Queues = newItems; + } + } +} diff --git a/QueryAndStack/QueryAndStack/Maze.cs b/QueryAndStack/QueryAndStack/Maze.cs new file mode 100644 index 0000000000000000000000000000000000000000..8379b92cd17cbe57611a467b6742ba0a9a957bbb --- /dev/null +++ b/QueryAndStack/QueryAndStack/Maze.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class Maze + { + private int pox { get; set; } + private int poy { get; set; } + private Direction dir { get; set; } + public Maze(int x, int y, Direction order) + { + this.poy = y; + this.pox = x; + dir = order; + } + private static Direction GetNextDir(Direction dir) + { + switch (dir.ToString()) + { + case "East": + dir = Direction.South; + break; + case "South": + dir = Direction.West; + break; + case "West": + dir = Direction.North; + break; + case "North": + dir = Direction.East; + break; + } + return dir; + } + private static Maze GetNextEle(Maze cur) + { + Maze ele = null; + int x = cur.pox; + int y = cur.poy; + switch (cur.dir.ToString()) + { + case "East": + ele = new Maze(x, ++y, Direction.East); + break; + case "South": + ele = new Maze(++x, y, Direction.East); + break; + case "West": + ele = new Maze(x, --y, Direction.East); + break; + case "North": + ele = new Maze(--x, y, Direction.East); + break; + } + return ele; + } + private static bool CanPass(Maze ele, int[,] arr) + { + int lenx = arr.GetLength(0); + int leny = arr.GetLength(1); + + if (ele.pox >= 0 && ele.poy >= 0 && ele.pox < lenx && ele.poy < leny) + { + if (arr[ele.pox, ele.poy] == 1) + { + return true; + } + return false; + } + else + { + return false; + } + } + public static void FindPath(Stack stack, int[,] arr,int[,]arr_new) + { + Maze start = new Maze(0, 0, Direction.East); + stack.Push(start); + arr[0, 0] = 2; + int count = 0;//搜索过的方位数 + do + { + Maze cur = stack.Peek();//获取栈顶的值 + if (cur.pox == 14 && cur.poy == 29)//如果当前节点是最后节点,结束搜索 + { + break; + } + Maze next = GetNextEle(cur);//当前节点的下一节点。 + if (CanPass(next, arr))//下一节点可通过 + { + stack.Push(next);//可通过的阶段保存到栈中 + arr[next.pox, next.poy] = 2;//已搜索过的节点变为2. + count = 0;//重新计数 + } + else if (count < 4) + { + cur.dir = GetNextDir(cur.dir);//变化方向继续搜索。 + count++;//搜索了一个方向,记录加1. + continue; + } + else + { + stack.Pop();//4个方向都不通,则从栈中移除当前节点(过来的节点已变成了2) + count = 0;//重新记录搜索次数 + } + } while (stack.Count > 0); + //栈空则表示没有通路; + if (stack.Count == 0) + { + Console.WriteLine("没有通路"); + } + else + { + for (int i = 0; i <= arr_new.GetUpperBound(0); i++) + { + for (int j = 0; j <= arr_new.GetUpperBound(1); j++) + { + Console.Write(arr_new[i, j]); + } + Console.WriteLine(); + } + Console.WriteLine("分割"); + + for (int i = stack.Count; i > 0; i--) + { + Maze ele = stack.Pop(); + //Console.WriteLine(ele.pox + " " + ele.poy + " " + ele.dir); + arr_new[ele.pox, ele.poy] = 2; + } + for (int i = 0; i <= arr_new.GetUpperBound(0); i++) + { + for (int j = 0; j <= arr_new.GetUpperBound(1); j++) + { + Console.Write(arr_new[i, j]); + } + Console.WriteLine(); + } + } + Console.Read(); + } + } +} diff --git a/QueryAndStack/QueryAndStack/MyLinkQueue.cs b/QueryAndStack/QueryAndStack/MyLinkQueue.cs new file mode 100644 index 0000000000000000000000000000000000000000..64d8b9641a5fea9fe64a12da7ecd489d002e9cba --- /dev/null +++ b/QueryAndStack/QueryAndStack/MyLinkQueue.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class MyLinkQueue + { + public Node Head; + public Node Tail; + public int Size; + + /// + /// 是否为空队列 + /// + /// true/false + public bool IsEmpty + { + get { return this.Size == 0; } + } + + + public MyLinkQueue() + { + this.Head = null; + this.Tail = null; + this.Size = 0; + } + /// + /// 入队 + /// + /// + public void EnQueue(T data) + { + Node targetNode = new Node(data); + + if (IsEmpty) + { + Head = Tail=targetNode; + } + else + { + Tail.Next = targetNode; + Tail = new Node(); + Tail = targetNode; + } + Size++; + } + /// + /// 出队 + /// + /// + public T DeQueue() + { + + if (IsEmpty) + { + Tail = null; + Console.WriteLine("队列为空"); + return default(T); + } + else + { + T result = Head.Data; + Head = Head.Next; + Size--; + return result; + } + + } + /// + /// 打印 + /// + public void PrintQueue() + { + + var temp = Head; + while (temp.Next != null) + { + Console.Write(temp.Data+"==>"); + } + Console.WriteLine(); + } + } +} diff --git a/QueryAndStack/QueryAndStack/MyQueue.cs b/QueryAndStack/QueryAndStack/MyQueue.cs new file mode 100644 index 0000000000000000000000000000000000000000..e0f64d0b91d00de0a162438d78f55ef094e7f7c0 --- /dev/null +++ b/QueryAndStack/QueryAndStack/MyQueue.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class MyQueue + { + public int Size { get; set; } + public T[] Queues; + public int Count { get; set; } + public int Head; + public int Tail; + public MyQueue() + { + this.Size = 0; + } + public MyQueue(int size) + { + this.Size = size; + this.Queues = new T[size]; + } + /// + /// 入队 + /// + /// + public void EnQueue(T data) + { + if (Count == Size) + { + //重构抽象出 扩容方法 + ExpansionArray.ResizeCapacity(Queues.Length * 2,ref Queues,ref Head,ref Tail); + //ResizeCapacity(Queues.Length * 2); + Console.WriteLine("队满,开始扩容"); + } + Queues[Tail] = data; + Tail++; + Count++; + } + /// + /// 出队 + /// + /// + public T Dequeue() + { + if (Count == 0) + { + return default(T); + } + else + { + T data = Queues[Head]; + Count--; + Queues[Head] = default(T); + Head++; + return data; + } + } + /// + /// 输出队列中的数 + /// + public void PrintQueue() + { + foreach(var item in Queues) + { + Console.Write(item+"==>"); + } + Console.WriteLine(); + } + /// + /// 队列扩容 + /// + /// 重构 已抽象 + /// + /// + public void ResizeCapacity(int newCapacity) + { + T[] newItems = new T[newCapacity]; + int index = 0; + if (newCapacity > Queues.Length) + { + for (int i = 0; i < Queues.Length; i++) + newItems[index++] = Queues[i]; + } + else + { + for (int i = 0; i < Queues.Length; i++) + { + if (!Queues[i].Equals(default(T))) + { + newItems[index++] = Queues[i]; + } + } + Head = Tail = 0; + } + Queues = newItems; + } + } +} diff --git a/QueryAndStack/QueryAndStack/Node.cs b/QueryAndStack/QueryAndStack/Node.cs new file mode 100644 index 0000000000000000000000000000000000000000..d93c1a60a5175e59a04121601c32d9fa786bb7fa --- /dev/null +++ b/QueryAndStack/QueryAndStack/Node.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class Node:IEnumerable + { + public Node Next { get; set; } + public T Data { get; set; } + public Node() + { + this.Next = null; + this.Data = default(T); + } + public Node(T data) + { + this.Data = data; + } + + public IEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } + } +} diff --git a/QueryAndStack/QueryAndStack/Program.cs b/QueryAndStack/QueryAndStack/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..fe6a5e935ccc3549701ffd58b64ed039e2015bac --- /dev/null +++ b/QueryAndStack/QueryAndStack/Program.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace QueryAndStack +{ + class Program + { + static void Main(string[] args) + { + + + // 01.基于链表的队列 + //QueueWithLinkListTest(); + // 02.基于数组的队列 + //QueueWithArrayTest(); + //03.基于链表的栈 + //StackWithLinkListTest(); + //04.基于数组的栈 + //StackWithArrayTest(); + //05.基于栈的迷宫 + //TestMaze(); + //06.后缀表达式 + //TestSuffixExpression(); + //07.浏览器前进和后退 + TestBrowserBackAndForward(); + + Console.ReadLine(); + } + + #region 基于链表的队列的测试 + /// + /// 基于链表的队列的测试 + /// + static void QueueWithLinkListTest() + { + MyLinkQueue queue = new MyLinkQueue(); + Random rand = new Random(); + // 顺序插入5个元素 + for (int i = 0; i < 5; i++) + { + int num = rand.Next(1, 10); + queue.EnQueue(num); + Console.WriteLine("{0} EnQueue.", num); + } + Console.WriteLine("Size:{0}", queue.Size); + Console.WriteLine("-------------------------"); + // 5个元素依次出队 + for (int i = 0; i < 5; i++) + { + Console.WriteLine("{0} dequeue.", queue.DeQueue()); + } + Console.WriteLine("Size:{0}", queue.Size); + Console.WriteLine("-------------------------"); + // 顺序插入10个元素 + for (int i = 0; i < 10; i++) + { + int num = rand.Next(1, 10); + queue.EnQueue(num); + Console.WriteLine("{0} enqueue.", num); + } + Console.WriteLine("Size:{0}", queue.Size); + Console.WriteLine("-------------------------"); + // 10个元素依次出队 + for (int i = 0; i < 10; i++) + { + Console.WriteLine("{0} dequeue.", queue.DeQueue()); + } + Console.WriteLine("Size:{0}", queue.Size); + } + #endregion + + #region 基于数组的队列的测试 + /// + /// 基于数组的队列的测试 + /// + static void QueueWithArrayTest() + { + MyQueue queue = new MyQueue(5); + Console.WriteLine("Size:{0}", queue.Size); + Random rand = new Random(); + // 顺序插入5个数据元素 + for (int i = 0; i < 5; i++) + { + int num = rand.Next(1, 10); + queue.EnQueue(num); + Console.WriteLine("{0} enqueue.", num); + } + Console.WriteLine("Size:{0}", queue.Size); + // Test1.2:临时插入1个数据元素验证数组是否扩容 + queue.EnQueue(rand.Next(1, 20)); + Console.WriteLine("Size:{0}", queue.Size); + Console.WriteLine("-------------------------"); + // Test2.1:前5个元素出队 + for (int i = 0; i < 5; i++) + { + Console.WriteLine("{0} dequeue.", queue.Dequeue()); + } + Console.WriteLine("Size:{0}", queue.Size); + Console.WriteLine("-------------------------"); + // 最后一个数据元素出队验证数组是否收缩容量 + queue.Dequeue(); + Console.WriteLine("Size:{0}", queue.Size); + Console.WriteLine("-------------------------"); + queue.Dequeue(); + } + #endregion + + #region 基于链表的栈的测试 + static void StackWithLinkListTest() + { + StackLinkList stackLinkList = new StackLinkList(); + Random ran = new Random(); + // 顺序插入5个元素 + for (int i = 0; i < 5; i++) + { + int num = ran.Next(1, 10); + stackLinkList.Push(num); + Console.WriteLine("{0} Push.", num); + } + Console.WriteLine("Size:{0}", stackLinkList.Size); + Console.WriteLine("-------------------------"); + //5个元素依次出栈 + for (int i = 0; i < 5; i++) + { + Console.WriteLine("{0} Pop.", stackLinkList.Pop()); + } + // 顺序插入10个元素 + for (int i = 0; i < 10; i++) + { + int num = ran.Next(1, 10); + stackLinkList.Push(num); + Console.WriteLine("{0} Push.", num); + } + Console.WriteLine("Size:{0}", stackLinkList.Size); + Console.WriteLine("-------------------------"); + //5个元素依次出栈 + for (int i = 0; i < 10; i++) + { + Console.WriteLine("{0} Pop.", stackLinkList.Pop()); + } + } + #endregion + + #region 基于数组的栈的测试 + static void StackWithArrayTest() + { + Stack stack = new Stack(5); + Console.WriteLine("Size:{0}", stack.Size); + Random rand = new Random(); + // 顺序插入5个数据元素 + for (int i = 0; i < 5; i++) + { + int num = rand.Next(1, 10); + stack.Push(num); + Console.WriteLine("{0} Push.", num); + } + Console.WriteLine("Size:{0}", stack.Size); + // 临时插入1个数据元素验证数组是否扩容 + stack.Push(rand.Next(1, 20)); + Console.WriteLine("Size:{0}", stack.Size); + Console.WriteLine("-------------------------"); + // 前5个元素出队 + for (int i = 0; i < 5; i++) + { + Console.WriteLine("{0} Pop.", stack.Pop()); + } + Console.WriteLine("Size:{0}", stack.Size); + Console.WriteLine("-------------------------"); + // 最后一个数据元素出队验证数组是否收缩容量 + stack.Pop(); + Console.WriteLine("Size:{0}", stack.Size); + Console.WriteLine("-------------------------"); + stack.Pop(); + } + #endregion + + #region 栈迷宫 + static void TestMaze() + { + #region 栈迷宫 + int[,] arr = new int[15, 30]{ + {1,0,1,0,0,1,0,0,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1}, + {1,1,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1}, + {1,0,1,0,1,0,1,1,1,1,0,0,0,1,0,0,1,1,0,0,0,0,1,1,1,1,0,0,1,1}, + {1,1,1,1,1,0,1,0,0,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,0}, + {1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,1,0}, + {1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,0}, + {1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0}, + {1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,0,0,1,0,0,0}, + {1,0,1,0,0,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,0,0,0,1,0,0,1,1,1,1}, + {1,0,1,0,0,1,1,1,0,1,0,0,1,0,1,0,1,0,0,1,1,1,0,1,0,0,1,0,0,0}, + {1,1,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,1,1,1,0,1,0,1,0,0,1,1,1,1}, + {1,0,1,1,0,1,0,1,0,1,0,0,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1}, + {1,1,0,1,0,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,1,1,1,0,1}, + {1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,1,1}, + {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} + }; + + int[,] arr_new = new int[15, 30]; + arr_new = (int[,])arr.Clone(); + Stack stack = new Stack(10); + Maze.FindPath(stack, arr, arr_new); + + Console.ReadLine(); + #endregion + } + #endregion + + #region 后缀表达式 + static void TestSuffixExpression() + { + Stack stack = new Stack(5); + stack.Push(7); + stack.Push(6); + stack.Push('*'); + stack.Push(5); + stack.Push('+'); + SuffixExpression suffixExpression = new QueryAndStack.SuffixExpression(stack); + Console.WriteLine("结果是:" + suffixExpression.CaluExpression(stack)); + Console.ReadLine(); + } + #endregion + + #region 计算表达式 + static void TestCalculation() + { + Calculation calculation = new Calculation(); + } + #endregion + #region 浏览器的前进与后退栈的实现 + static void TestBrowserBackAndForward() + { + Stack browser = new Stack(5); + Stack history = new Stack(5); + browser.Push("A"); + browser.Push("B"); + browser.Push("C"); + browser.Push("D"); + browser.Push("E"); + + //前进 + browser.BrowserForward(history); + browser.BrowserForward(history); + browser.BrowserForward(history); + //后退 + browser.BrowserBack(history); + browser.BrowserBack(history); + + Console.ReadLine(); + } + #endregion + + } +} + + diff --git a/QueryAndStack/QueryAndStack/QueryAndStack.csproj b/QueryAndStack/QueryAndStack/QueryAndStack.csproj new file mode 100644 index 0000000000000000000000000000000000000000..c73e0d1692ab38cc8596bbd32ae080d903aaa778 --- /dev/null +++ b/QueryAndStack/QueryAndStack/QueryAndStack.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/QueryAndStack/QueryAndStack/Stack.cs b/QueryAndStack/QueryAndStack/Stack.cs new file mode 100644 index 0000000000000000000000000000000000000000..daf4173ff147fec54b55bcc8ee7c02d655cf1be4 --- /dev/null +++ b/QueryAndStack/QueryAndStack/Stack.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Text; + +namespace QueryAndStack +{ + public class Stack + { + + public int Size { get; set; } + public int Top { get; set; } + public T[] arr; + public bool IsFull { get => Top == Size - 1; } + public bool IsEmpty { get => Top == -1; } + public int Count { get; set; } + public Stack(int size) + { + this.Top = -1; + this.Size = size; + this.arr = new T[this.Size]; + } + /// + /// 进栈 + /// + /// + public void Push(T number) + { + if (Top == arr.Length-1) + { + ResizeCapacity(arr.Length * 2); + Console.WriteLine("栈满!开始扩容"); + + } + else + { + arr[++Top] = number; + Count++; + } + } + /// + /// 出栈 + /// + /// + public T Pop() + { + if (!IsEmpty) + { + Count--; + var temp = arr[Top]; + arr[Top--] = default(T); + return temp; + } + else + { + Console.WriteLine("栈空!请插入后在进行操作"); + return default(T); + } + } + /// + /// 打印栈 + /// + public void ShowStack() + { + var count = Top; + while (count >= 0) + { + Console.WriteLine(arr[count--]); + } + } + /// + /// 弹出栈顶元素 (不改变栈的结构) + /// + /// + public T Peek() + { + if (IsEmpty) + { + + throw new ArgumentNullException("栈为空,请插入后在进行操作"); + } + else + { + return arr[Top]; + } + } + /// + /// 栈的扩容 + /// + /// + public void ResizeCapacity(int newCapacity) + { + T[] newItems = new T[newCapacity]; + int index = 0; + if (newCapacity > arr.Length) + { + for (int i = 0; i < arr.Length; i++) + newItems[index++] = arr[i]; + } + else + { + for (int i = 0; i < arr.Length; i++) + { + if (!arr[i].Equals(default(T))) + { + newItems[index++] = arr[i]; + } + } + } + arr = newItems; + } + + /// + /// 浏览器返回 + /// + /// + public void BrowserBack(Stack history) + { + try + { + if (history.IsEmpty) + { + Console.WriteLine("无路可退了~禁止后退"); + } + else + { + var Record = history.Pop(); + this.Push(Record); + Console.WriteLine($"浏览器后退到了{this.Peek()}页面"); + } + + } + catch (Exception ex) + { + + throw new ArgumentNullException("出错,请检查栈:"+ex.Message); + } + + } + /// + /// 浏览器前进 + /// + /// + public void BrowserForward(Stack history) + { + try + { + var Record = this.Pop(); + history.Push(Record); + Console.WriteLine($"浏览器请进到了{this.Peek()}页面"); + } + catch (Exception ex) + { + + throw new ArgumentNullException("出错,请检查栈:"+ex.Message); + } + } + + public IEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } + } +} diff --git a/QueryAndStack/QueryAndStack/StackLinkList.cs b/QueryAndStack/QueryAndStack/StackLinkList.cs new file mode 100644 index 0000000000000000000000000000000000000000..fb84a1973ced5c93acb1ce3b84a5f92c42ce9bb8 --- /dev/null +++ b/QueryAndStack/QueryAndStack/StackLinkList.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace QueryAndStack +{ + public class StackLinkList + { + /// + /// 栈顶 + /// + public Node Top { get; set; } + public int Size { get; set; } + public bool IsEmpty { get => Top == null; } + public StackLinkList() + { + this.Size = 0; + Top = null; + } + public StackLinkList(int size) + { + this.Size = size; + } + /// + /// Push + /// + /// + public void Push(T data) + { + Node targeNode = new Node(data); + if (!IsEmpty) + { + targeNode.Next = Top; + Top = targeNode; + } + else + { + Top = targeNode; + } + Size++; + } + /// + /// Pop弹出 + /// + /// + public T Pop() + { + if (!IsEmpty) + { + + T data = Top.Data; + Top = Top.Next; + Size--; + return data; + } + else + { + Console.WriteLine("栈空"); + return default(T); + } + } + } +} diff --git a/QueryAndStack/QueryAndStack/SuffixExpression.cs b/QueryAndStack/QueryAndStack/SuffixExpression.cs new file mode 100644 index 0000000000000000000000000000000000000000..103eb569173a31ec1de9e2bd20fc2c34953506e1 --- /dev/null +++ b/QueryAndStack/QueryAndStack/SuffixExpression.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace QueryAndStack +{ + public class SuffixExpression + { + private Stack stack; + public SuffixExpression(Stack stack) + { + this.stack = stack; + } + public int CaluExpression(Stack stack) + { + Stack operators = new Stack(stack.Count); + Stack number = new Stack(stack.Count); + while (stack.Count > 0) + { + var temp = stack.Pop(); + JudgeCharOrNumber(temp, operators, number); + } + Sum(operators, number); + return number.Pop(); + } + private void JudgeCharOrNumber(T temp,Stackoperators,Stacknumbers) + { + if(temp is int) + { + var number = Convert.ToInt32(temp); + numbers.Push(number); + } + else + { + var opr = Convert.ToChar(temp); + operators.Push(opr); + } + } + private void Sum(Stack opr, Stack number) + { + var count = opr.Count; + for(int i = 0; i < count; i++) + { + CalCulateExpressions(number,opr.Pop()); + } + } + private void CalCulateExpressions(Stack number,char opr) + { + var sum = 0; + switch (opr) + { + case '+': + sum = Convert.ToInt32(number.Pop()) +Convert.ToInt32(number.Pop()); + break; + case '-': + sum = Convert.ToInt32(number.Pop()) - Convert.ToInt32(number.Pop()); + break; + case '*': + sum = Convert.ToInt32(number.Pop()) * Convert.ToInt32(number.Pop()); + break; + case '/': + sum = Convert.ToInt32(number.Pop()) / Convert.ToInt32(number.Pop()); + break; + default: + Console.WriteLine("错误!!,未找到操作符"); + break; + } + number.Push(sum); + } + + } +} diff --git a/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.deps.json b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.deps.json new file mode 100644 index 0000000000000000000000000000000000000000..503c14ada7d54251e09a0da05b087e3482a56e34 --- /dev/null +++ b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v3.1", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v3.1": { + "QueryAndStack/1.0.0": { + "runtime": { + "QueryAndStack.dll": {} + } + } + } + }, + "libraries": { + "QueryAndStack/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.dll b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.dll new file mode 100644 index 0000000000000000000000000000000000000000..0a717d03296a9635873e0ab18a858b97e2a2c5fe Binary files /dev/null and b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.dll differ diff --git a/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.exe b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.exe new file mode 100644 index 0000000000000000000000000000000000000000..e76d5ac1cae4d5ae96f4e5549a7113bace6cf306 Binary files /dev/null and b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.exe differ diff --git a/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.pdb b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.pdb new file mode 100644 index 0000000000000000000000000000000000000000..da0bbd65d3b4f5864f58003a5670597baa6a2920 Binary files /dev/null and b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.pdb differ diff --git a/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.runtimeconfig.dev.json b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.runtimeconfig.dev.json new file mode 100644 index 0000000000000000000000000000000000000000..74b49a8534262c0630900f900b4dcb2a3326051f --- /dev/null +++ b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.runtimeconfig.dev.json @@ -0,0 +1,10 @@ +{ + "runtimeOptions": { + "additionalProbingPaths": [ + "C:\\Users\\Admin\\.dotnet\\store\\|arch|\\|tfm|", + "C:\\Users\\Admin\\.nuget\\packages", + "D:\\Microsoft\\Xamarin\\NuGet", + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ] + } +} \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.runtimeconfig.json b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.runtimeconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..bc456d7868bb54ec1809da30e339cd43f0a8a09c --- /dev/null +++ b/QueryAndStack/QueryAndStack/bin/Debug/netcoreapp3.1/QueryAndStack.runtimeconfig.json @@ -0,0 +1,9 @@ +{ + "runtimeOptions": { + "tfm": "netcoreapp3.1", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "3.1.0" + } + } +} \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs new file mode 100644 index 0000000000000000000000000000000000000000..ad8dfe1a6310302587a2d0c0111d81b250eb4105 --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.AssemblyInfo.cs b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..e74ca835c8398a205aa364ee5ab5cb1d458dd538 --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("QueryAndStack")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("QueryAndStack")] +[assembly: System.Reflection.AssemblyTitleAttribute("QueryAndStack")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// 由 MSBuild WriteCodeFragment 类生成。 + diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.AssemblyInfoInputs.cache b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.AssemblyInfoInputs.cache new file mode 100644 index 0000000000000000000000000000000000000000..aa8dd464bc1e09cc3064b8b8bc8f77ef0fe8c741 --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +2e4feeda605016e7750b77534fb671a67a8615a1 diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.assets.cache b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..fd5a54bdca44716d87d46d6f6eaded63114265bc Binary files /dev/null and b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.assets.cache differ diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csproj.CoreCompileInputs.cache b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000000000000000000000000000000000000..e7b7e45b5f6915cb7fcff2ab71e013d2eeb7494f --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +e6379b557faa17f8e45b7a81dbaba884fe87e6a1 diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csproj.FileListAbsolute.txt b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csproj.FileListAbsolute.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a3c17ef1e33ab03e92f9cc29259fdc5ae94ba05 --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csproj.FileListAbsolute.txt @@ -0,0 +1,26 @@ +E:\项目\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.exe +E:\项目\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.deps.json +E:\项目\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.runtimeconfig.json +E:\项目\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.runtimeconfig.dev.json +E:\项目\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.dll +E:\项目\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.pdb +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.csprojAssemblyReference.cache +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.AssemblyInfoInputs.cache +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.AssemblyInfo.cs +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.csproj.CoreCompileInputs.cache +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.dll +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.pdb +E:\项目\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.genruntimeconfig.cache +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.exe +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.deps.json +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.runtimeconfig.json +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.runtimeconfig.dev.json +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.dll +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\bin\Debug\netcoreapp3.1\QueryAndStack.pdb +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.csprojAssemblyReference.cache +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.AssemblyInfoInputs.cache +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.AssemblyInfo.cs +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.csproj.CoreCompileInputs.cache +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.dll +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.pdb +C:\Users\Admin\Desktop\数据结构\lec03-stack-queue\QueryAndStack\QueryAndStack\obj\Debug\netcoreapp3.1\QueryAndStack.genruntimeconfig.cache diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csprojAssemblyReference.cache b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csprojAssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..28d58aefeb25d096925a91f2b9e911eda0e4c6ed Binary files /dev/null and b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.csprojAssemblyReference.cache differ diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.dll b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.dll new file mode 100644 index 0000000000000000000000000000000000000000..0a717d03296a9635873e0ab18a858b97e2a2c5fe Binary files /dev/null and b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.dll differ diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.exe b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.exe new file mode 100644 index 0000000000000000000000000000000000000000..e76d5ac1cae4d5ae96f4e5549a7113bace6cf306 Binary files /dev/null and b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.exe differ diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.genruntimeconfig.cache b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.genruntimeconfig.cache new file mode 100644 index 0000000000000000000000000000000000000000..34bedab819ef1631d37d6e87ef9a716c545a105e --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.genruntimeconfig.cache @@ -0,0 +1 @@ +86c8e15dd33445635927cfaf398408205fd11473 diff --git a/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.pdb b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.pdb new file mode 100644 index 0000000000000000000000000000000000000000..da0bbd65d3b4f5864f58003a5670597baa6a2920 Binary files /dev/null and b/QueryAndStack/QueryAndStack/obj/Debug/netcoreapp3.1/QueryAndStack.pdb differ diff --git a/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.dgspec.json b/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.dgspec.json new file mode 100644 index 0000000000000000000000000000000000000000..8fc47f8ed4996adf69bc82f32df4310d3bf2e1d1 --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.dgspec.json @@ -0,0 +1,65 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj": {} + }, + "projects": { + "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj", + "projectName": "QueryAndStack", + "projectPath": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "D:\\Microsoft\\Xamarin\\NuGet\\", + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.g.props b/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.g.props new file mode 100644 index 0000000000000000000000000000000000000000..f6e03c3fcd2bdd7182cb7abad1f0f06af85da81c --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.g.props @@ -0,0 +1,18 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Admin\.nuget\packages\;D:\Microsoft\Xamarin\NuGet\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder + PackageReference + 5.7.0 + + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.g.targets b/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.g.targets new file mode 100644 index 0000000000000000000000000000000000000000..53cfaa19b16f3769b2bfc33db3b5c0053c16fdba --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/QueryAndStack.csproj.nuget.g.targets @@ -0,0 +1,6 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/obj/project.assets.json b/QueryAndStack/QueryAndStack/obj/project.assets.json new file mode 100644 index 0000000000000000000000000000000000000000..6fe1420998abc24f7ed96aa4a56a43f95b8e909b --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/project.assets.json @@ -0,0 +1,72 @@ +{ + "version": 3, + "targets": { + ".NETCoreApp,Version=v3.1": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + ".NETCoreApp,Version=v3.1": [] + }, + "packageFolders": { + "C:\\Users\\Admin\\.nuget\\packages\\": {}, + "D:\\Microsoft\\Xamarin\\NuGet\\": {}, + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj", + "projectName": "QueryAndStack", + "projectPath": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj", + "packagesPath": "C:\\Users\\Admin\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "D:\\Microsoft\\Xamarin\\NuGet\\", + "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" + ], + "configFilePaths": [ + "C:\\Users\\Admin\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Xamarin.Offline.config" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.403\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/QueryAndStack/QueryAndStack/obj/project.nuget.cache b/QueryAndStack/QueryAndStack/obj/project.nuget.cache new file mode 100644 index 0000000000000000000000000000000000000000..2248b31a4a9eea0f976bffe619a673e0325af45a --- /dev/null +++ b/QueryAndStack/QueryAndStack/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "npvIebLpKzIvDsii8DW1KfSeHSQZdCilaYJlWva6F1IPUJPIZfbAflpYfATeCnjtSODdqq6ko3kcn16kZIqHWg==", + "success": true, + "projectFilePath": "C:\\Users\\Admin\\Desktop\\数据结构\\lec03-stack-queue\\QueryAndStack\\QueryAndStack\\QueryAndStack.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/README.md b/README.md index b56d41814e6fc4263b6e400d2ae4acb5dfafe72a..c69c7c110ace5fbab3b5ae4847d2da30a00a8a6e 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,4 @@ ## Questions 1. 如何提交?[参考作业提交流程.pdf](./作业提交流程.pdf) 文件 +