Data | structure | algorithm data structure and algorithm (C # implementation) Series---demo (i.)
Heavenkiller (original)
This article is mainly for the future of the data types to carry out a substantive demonstration. Therefore, I hope that we have a specific look at the various data structure analysis and then look at this article.
Mainly includes the following several aspects of the demonstration:
1. Stack. Demonstrates a RPN calculator that uses a stack
2. Sort table. Demonstrates an addition operation that uses a sort table to do polynomial expressions
3. Generalized tree. Demonstrates depth traversal and breadth traversal
4. N Fork Tree. Demonstrates the basic operations of N-fork tree Generation Insert Deletion
5. An expression tree. Demonstrates an example of using a binary tree and a stack to translate a suffix expression into a familiar infix expression in everyday life.
6. AVL Tree. Demonstrates basic operations
Using System;
Using System.Collections;
Namespace Datastructure
{
<summary>
Summary description of the CLASS1.
</summary>
Class Show
{
<summary>
The main entry point for 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 ()///demo of attach and detach of a three-pronged tree
Break
Case "5":
Showexpressiontree ();
Break
Case "6":
Showavltree ();
Break
Case "7":
Showbinaryheap ();
Break
Case "Exit":
Return
Default
Break
}
}
}
public static void Showbinaryheap ()
{
Constructs a binary heap that contains 2,4,6,8,10,12
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.