public static int FindMin (Stack<int> stk)
Stack<int> temp = new Stack<int>();
public static void Remove (Stack<int> stk, int num)
Stack<int> temp = new Stack<int>();
while (!stk.IsEmpty() && stk.Top()!=num)
if (!stk.IsEmpty() && stk.Top()==num)
public static void Sort (Stack<int> stk)
Stack<int> temp = new Stack<int>();
public static Stack<int> MergeSort (Stack<int> s1, Stack<int> s2)
Stack<int> stk = new Stack<int>();
Stack<int> temp = new Stack<int>();
while (!s1.IsEmpty() && !s2.IsEmpty())
else if (s2.Top()<s1.Top())
public static string StartWithLowestLetter (Stack<string> stk)
string tmp = StartWithLowestLetter(stk);
public static void Main()
Console.WriteLine("Hello World");
Stack<int> s = new Stack<int> ();
Console.WriteLine(s.ToString());
Console.WriteLine(FindMin(s));
Console.WriteLine(s.ToString());
Console.WriteLine(FindMin(s));
Console.WriteLine(FindMin(s));
Console.WriteLine(s.ToString());
Console.WriteLine("-------------------------");
Stack<int> s1 = new Stack<int> ();
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine(s1.ToString());
Console.WriteLine("-------------------------");
Stack<int> s4 = new Stack<int> ();
Stack<int> s5 = new Stack<int> ();
Console.WriteLine(s4.ToString());
Console.WriteLine(s5.ToString());
Stack<int> newS = MergeSort(s4,s5);
Console.WriteLine(newS.ToString());
Console.WriteLine("-------------------------");
Stack<string> sss = new Stack<string> ();
Console.WriteLine(StartWithLowestLetter(sss));
public static BinNode<int> BuildBnlistInt ()
BinNode<int> duList = new BinNode<int> (int.Parse(Console.ReadLine()));
BinNode<int> last = duList;
int num = int.Parse(Console.ReadLine());
BinNode<int> p = new BinNode<int> (num);
num = int.Parse(Console.ReadLine());
public static void ShowBnlist (BinNode<int> lst)
Console.Write(pos.ToString());
public static Node<int> Build (int n)
Console.WriteLine("enter number");
x=int.Parse(Console.ReadLine());
pos.SetNext(new Node<int>(x));
public static Node<int> CreateList (int numNodes)
Node<int> lst = new Node<int>(-1);
for (i=1; i<=numNodes; i++)
Console.WriteLine("enter number");
x=int.Parse(Console.ReadLine());
pos.SetNext(new Node<int>(x));
public static void Show (Node<int> lst)
Console.Write(pos.ToString());
this.first=new Node<T> (x,this.first);
T x=this.first.GetValue();
this.first=this.first.GetNext();
return this.first.GetValue();
public override String ToString()
Node<T> pos = this.first;
str=str+pos.GetValue().ToString();
public Node (T value, Node<T> next)
public void SetValue (T value)
public void SetNext(Node<T> next)
return this.next != null;
public override String ToString()
return this.value.ToString() +" ";
Node<T> temp = new Node<T>(x);
T x=this.first.GetValue();
this.first=this.first.GetNext();
return this.first.GetValue();
public override String ToString ()
Node<T> pos = this.first;
str=str+pos.GetValue().ToString();
private BinNode<T> right;
public BinNode (BinNode<T> left, T x, BinNode<T> right)
public BinNode<T> GetLeft()
public BinNode<T> GetRight()
public void SetValue(T x)
public void SetLeft(BinNode<T> left)
public void SetRight(BinNode<T> right)
public override String ToString ()
return "("+this.left+" "+this.value.ToString()+" "+this.right+")";