TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Stack Class implementation for basic methods of Stack Data Structure. More...
Public Member Functions | |
int | top () |
void | push (int val) |
Inserts an element to the top of the stack. | |
void | pop () |
Removes the topmost element from the stack. | |
int | size () |
Utility function to return the current size of the stack. | |
Public Attributes | |
std::queue< int64_t > | main_q |
stores the current state of the stack | |
std::queue< int64_t > | auxiliary_q |
uint32_t | current_size = 0 |
stores the current size of the stack | |
Stack Class implementation for basic methods of Stack Data Structure.
Definition at line 31 of file stack_using_queue.cpp.
|
inline |
Removes the topmost element from the stack.
Definition at line 62 of file stack_using_queue.cpp.
|
inline |
Inserts an element to the top of the stack.
val | the element that will be inserted into the stack |
Definition at line 48 of file stack_using_queue.cpp.
|
inline |
Utility function to return the current size of the stack.
Definition at line 74 of file stack_using_queue.cpp.
|
inline |
Returns the top most element of the stack
Definition at line 41 of file stack_using_queue.cpp.
std::queue<int64_t> data_structures::stack_using_queue::Stack::auxiliary_q |
used to carry out intermediate operations to implement stack
Definition at line 33 of file stack_using_queue.cpp.
uint32_t data_structures::stack_using_queue::Stack::current_size = 0 |
stores the current size of the stack
Definition at line 35 of file stack_using_queue.cpp.
std::queue<int64_t> data_structures::stack_using_queue::Stack::main_q |
stores the current state of the stack
Definition at line 32 of file stack_using_queue.cpp.