Advertisement
AvengersAssemble

Q4

Nov 2nd, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1.      // Q4
  2.         public static Stack<int> BiggestInNode(Stack<Node<int>> stk)
  3.         {
  4.             Console.WriteLine("Biggest Numbers:");
  5.             Stack<int> NumStack = new Stack<int>();
  6.             Node<int> temp;
  7.  
  8.             while (stk.IsEmpty() == false)
  9.             {
  10.  
  11.                 temp = stk.Pop();
  12.                 int max = temp.GetInfo();
  13.                 while (temp != null)
  14.                 {
  15.                     if (temp.GetInfo() > max)
  16.                     {
  17.                         max = temp.GetInfo();
  18.                     }
  19.  
  20.                     temp = temp.GetNext();
  21.                 }
  22.  
  23.                 NumStack.Push(max);
  24.             }
  25.  
  26.             return NumStack;
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement