Data structures and algorithms (C # implementation) series --- demonstration (1)
Heavenkiller (original)
This article provides a substantial demonstration of the Data Types in the future. Therefore, I hope you can read the analysis of various data structures again.
The demo mainly includes the following aspects:
1. Stack. Demonstrate an RPN calculator using stacks
2. Sort the table. Demonstrate an addition operation of Polynomial expressions using sorting tables
3. generalized tree. Demonstrate depth traversal and breadth Traversal
4. N. Demonstrate basic operations such as generation, insertion, and deletion of the N-tree
5. Expression Tree. Demonstrate an example of translating a suffix expression into a common infix expression using a binary tree and a stack.
6. AVL Tree. Demonstrate basic operations
Using System;
Using System. Collections;
Namespace DataStructure
{
/// <Summary>
/// Summary of Class1.
/// </Summary>
Class Show
{
/// <Summary>
/// Main entry point of the application.
/// </Summary>
[STAThread]
Static void Main (string [] args)
{
//
// TODO: Add code here to start the application
//
While (true)
{
Console. WriteLine ("please choose a No. of a item you want to perform :");
Console. WriteLine ("1. Stack ----- RPNCalCulator ");
Console. WriteLine ("2. SortedList ----- the addition of polynomial realized by sortedlist ");
Console. WriteLine ("3. GeneralTree ---- depthtravesal and breathtraval ");
Console. WriteLine ("4. NaryTree ");
Console. WriteLine ("5. ExpressionTree ");
Console. WriteLine ("6. AVLTree ");
Console. WriteLine ("7. BinaryHeap ");
Console. WriteLine ("exit -- Exit this programme ");
// Test ();
Switch (Console. ReadLine ())
{
Case "1": // Show Stack
ShowStack_RPNCalCulator ();
Break;
Case "2": // SortedList
ShowSortedList_Polynomial ();
Break;
Case "3 ":
ShowGeneralTree_travel ();
Break;
Case "4 ":
ShowNaryTree (); // demonstrate Attach and Detach of A Three-tree
Break;
Case "5 ":
ShowExpressionTree ();
Break;
Case "6 ":
ShowAVLTree ();
Break;
Case "7 ":