6#ifndef DATA_STRUCTURES_STACK_H_
7#define DATA_STRUCTURES_STACK_H_
32 while (current !=
nullptr) {
34 current = current->next;
54 if (otherStack.
stackTop ==
nullptr) {
62 current = current->next;
64 while (current !=
nullptr) {
66 newNode->data = current->data;
67 newNode->next =
nullptr;
70 current = current->next;
122 if (otherStack.
stackTop ==
nullptr) {
130 current = current->next;
132 while (current !=
nullptr) {
134 newNode->data = current->data;
135 newNode->next =
nullptr;
136 last->next = newNode;
138 current = current->next;
bool isEmptyStack()
Definition: stack.h:80
~stack()
Definition: stack.h:77
Type top()
Definition: stack.h:93
stack< Type > & operator=(const stack< Type > &otherStack)
Definition: stack.h:115
void push(Type item)
Definition: stack.h:83
stack()
Definition: stack.h:41
void clear()
Definition: stack.h:112
void display()
Definition: stack.h:29
void pop()
Definition: stack.h:99
node< Type > * stackTop
Definition: stack.h:146
int size
size of stack
Definition: stack.h:147
stack(const stack< Type > &otherStack)
Definition: stack.h:47
Definition: avltree.cpp:13
node< Type > * next
pointer to the next node instance
Definition: stack.h:18
Type data
data at current node
Definition: stack.h:17