Stack Class implementation for basic methods of Stack Data Structure.
More...
|
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.
|
|
|
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.
◆ pop()
void data_structures::stack_using_queue::Stack::pop |
( |
| ) |
|
|
inline |
Removes the topmost element from the stack.
- Returns
- void
61 {
63 return;
64 }
67 }
std::queue< int64_t > main_q
stores the current state of the stack
Definition stack_using_queue.cpp:31
uint32_t current_size
stores the current size of the stack
Definition stack_using_queue.cpp:34
◆ push()
void data_structures::stack_using_queue::Stack::push |
( |
int | val | ) |
|
|
inline |
Inserts an element to the top of the stack.
- Parameters
-
val | the element that will be inserted into the stack |
- Returns
- void
47 {
52 }
55 }
std::queue< int64_t > auxiliary_q
Definition stack_using_queue.cpp:32
◆ size()
int data_structures::stack_using_queue::Stack::size |
( |
| ) |
|
|
inline |
Utility function to return the current size of the stack.
- Returns
- current size of stack
◆ top()
int data_structures::stack_using_queue::Stack::top |
( |
| ) |
|
|
inline |
Returns the top most element of the stack
- Returns
- top element of the queue
◆ auxiliary_q
std::queue<int64_t> data_structures::stack_using_queue::Stack::auxiliary_q |
used to carry out intermediate operations to implement stack
The documentation for this struct was generated from the following file:
- data_structures/stack_using_queue.cpp