Tag: stack
All the articles with the tag "stack".
-
Queue vs Stack in C++: LIFO vs FIFO, STL & Practical Comparison
Understand the difference between Queue and Stack in C++. Compare FIFO vs LIFO ordering, insertion and deletion ends, accessible elements, std::queue vs std::stack in C++ STL, visual element traces, time complexity, and when to use each.
-
Top 5 Famous Stack Problems in Competitive Programming (With C++ Solutions)
Master the 5 most famous Stack problems in competitive programming and coding interviews: Valid Parentheses, Min Stack, Next Greater Element, Daily Temperatures, and Largest Rectangle in Histogram—complete with C++ code, dry runs, and monotonic stack diagrams.
-
Stack Using Linked List in C++: Dynamic Node & Pointer Implementation
Learn how to implement a Stack using a singly linked list in C++ from scratch. Understand Node structs, the top pointer, dynamic memory allocation with new and delete, destructor cleanup, visual pointer diagrams, and array vs linked list trade-offs.
-
Stack Using Array: Fixed-Size Implementation, Overflow & Dry Run
Learn how to implement a Stack using a fixed-size array in C++ without STL. Understand why top starts at -1, how push and pop work, Stack Overflow and Underflow, visual dry runs, and why pop() doesn't erase physical memory.