Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Q4
- public static Stack<int> BiggestInNode(Stack<Node<int>> stk)
- {
- Console.WriteLine("Biggest Numbers:");
- Stack<int> NumStack = new Stack<int>();
- Node<int> temp;
- while (stk.IsEmpty() == false)
- {
- temp = stk.Pop();
- int max = temp.GetInfo();
- while (temp != null)
- {
- if (temp.GetInfo() > max)
- {
- max = temp.GetInfo();
- }
- temp = temp.GetNext();
- }
- NumStack.Push(max);
- }
- return NumStack;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement