int main (int argv, char **argc) { MaxStack maxStackObj; try { maxStackObj.Pop(); } catch (std::exception &e) { std::cout << e.what() << std::endl; } try { maxStackObj.Max(); } catch (std::exception &e) { std::cout << e.what() << std::endl; } maxStackObj.Push(-78); std::cout << "Max: " << maxStackObj.Max() << std::endl; maxStackObj.Push(-7); std::cout << "Max: " << maxStackObj.Max() << std::endl; maxStackObj.Push(3); std::cout << "Max: " << maxStackObj.Max() << std::endl; maxStackObj.Pop(); std::cout << "Max: " << maxStackObj.Max() << std::endl; maxStackObj.Pop(); std::cout << "Max: " << maxStackObj.Max() << std::endl; maxStackObj.Pop(); maxStackObj.Push(0); std::cout << "Max: " << maxStackObj.Max() << std::endl; maxStackObj.Push(100); std::cout << "Max: " << maxStackObj.Max() << std::endl; Stack stackObj; std::cout << "Result of RPN expr: (3 4 + 2 * 1 +) is :" << stackObj.EvaluateRpn("3 4 + 2 * 1 +") << std::endl; std::cout << "Result of RPN expr: (5 1 2 + 4 * + 3 -) is :" << stackObj.EvaluateRpn("5 1 2 + 4 * + 3 -") << std::endl; std::cout << "Expression : [({[()]})] is :"; stackObj.IsWellFormed("[({[()]})]") ? std::cout << "Well Formed" << std::endl : std::cout << "Not Well Formed" << std::endl; std::cout << "Expression : [{{{}}}[][]]]]({[()]})] is :"; stackObj.IsWellFormed("[{{{}}}[][]]]]({[()]})]") ? std::cout << "Well Formed" << std::endl : std::cout << "Not Well Formed" << std::endl; std::cout << "Expression : ({[()]}){{}}[ is :"; stackObj.IsWellFormed("({[()]}){{}}[") ? std::cout << "Well Formed" << std::endl : std::cout << "Not Well Formed" << std::endl; Node node(23); Node node1(37); Node node2(29); Node node3(41); Node node4(31); node.right = &node1; node1.left = &node2; node1.right = &node3; node2.right = &node4; std::cout << "BST InOrder with stack from 23 is: " << std::endl; std::vector<int> inOrder = stackObj.BSTSortedOrderWithStack(&node); for (auto i : inOrder) { std::cout << i << " "; } std::cout << std::endl; std::cout << "Building with input stream East to West: [4 3 5 3 1 4 2] " << std::endl; std::cout << "Building indices with sunset views are: " << std::endl; std::vector<int> result1 = stackObj.BuildingsWithSunsetViewEastToWest("4 3 5 3 1 4 2"); for (auto i : result1) { std::cout << i+1 << " "; } std::cout << std::endl; std::cout << "Building with input stream West to East: [2 4 1 3 5 3 4] " << std::endl; std::cout << "Building indices with sunset views are: " << std::endl; std::vector<int> result2 = stackObj.BuildingsWithSunsetViewWestToEast("2 4 1 3 5 3 4"); for (auto i : result2) { std::cout << i+1 << " "; } std::cout << std::endl; std::stack<int> s; s.push(5); s.push(4); s.push(3); s.push(2); s.push(1); std::cout << "Stack with LIFO: 1 2 3 4 5" << std::endl; stackObj.SortStack(s); std::cout << "Sorted Stack in descending order" << std::endl; int size = s.size(); for (int i = 0; i < size; i++) { std::cout << s.top() << " "; s.pop(); } std::cout << std::endl; return 0; }