|
Algorithms_in_C++
1.0.0
Set of algorithms implemented in C++.
|
Go to the documentation of this file.
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;
150 #endif // DATA_STRUCTURES_STACK_H_
void pop()
Definition: stack.h:99
stack(const stack< Type > &otherStack)
Definition: stack.h:47
Functions for Queue using Array implementation.
Node(int key, int level, void *value=nullptr)
Definition: skip_list.cpp:44
int8_t front
Index of head of the array.
Definition: queue_using_array.cpp:46
void displayList()
Definition: skip_list.cpp:191
int level
Maximum level of the skiplist.
Definition: skip_list.cpp:56
constexpr int MAX_LEVEL
Maximum level of skip list.
Definition: skip_list.cpp:27
Definition: skip_list.cpp:55
Definition: avltree.cpp:13
Queue_Array class containing the main data and also index of head and tail of the array.
Definition: queue_using_array.cpp:40
int main()
Definition: skip_list.cpp:212
Definition: skip_list.cpp:33
int main()
Definition: graph_coloring.cpp:96
int main()
Main function.
Definition: queue_using_array.cpp:109
void * value
pointer of value
Definition: skip_list.cpp:35
Definition: queue_using_linkedlist.cpp:10
void queue_test()
Definition: queue_using_two_stacks.cpp:101
int8_t rear
Index of tail of the array.
Definition: queue_using_array.cpp:47
Definition: queue_using_linkedlist.cpp:6
std::array< int16_t, max_size > arr
All stored data.
Definition: queue_using_array.cpp:48
Data Structures algorithms.
void push(Type item)
Definition: stack.h:83
int key
key integer
Definition: skip_list.cpp:34
int size
size of stack
Definition: stack.h:147
SkipList()
Definition: skip_list.cpp:64
node< Type > * next
pointer to the next node instance
Definition: stack.h:18
Type top()
Definition: stack.h:93
int data[MAX]
test data
Definition: hash_search.cpp:24
int main()
Definition: queue_using_two_stacks.cpp:141
stack()
Definition: stack.h:41
std::vector< std::shared_ptr< Node > > forward
nodes of the given one in all levels
Definition: skip_list.cpp:37
stack< Type > & operator=(const stack< Type > &otherStack)
Definition: stack.h:115
void deleteElement(int key)
Definition: skip_list.cpp:133
void show(const struct tower *const F, const struct tower *const T, const struct tower *const U)
Definition: tower_of_hanoi.cpp:19
int randomLevel()
Definition: skip_list.cpp:75
void enqueue(const int16_t &)
Add element to the first of the queue.
Definition: queue_using_array.cpp:55
void display()
Definition: stack.h:29
bool isEmptyStack()
Definition: stack.h:80
Type data
data at current node
Definition: stack.h:17
node< Type > * stackTop
Definition: stack.h:146
std::shared_ptr< Node > header
Pointer to the header node.
Definition: skip_list.cpp:57
~stack()
Definition: stack.h:77
int dequeue()
Delete element from back of the queue.
Definition: queue_using_array.cpp:72
void push(char ch)
push byte to stack variable
Definition: paranthesis_matching.cpp:26
char pop()
pop a byte out of stack variable
Definition: paranthesis_matching.cpp:29
constexpr float PROBABILITY
Current probability for "coin toss".
Definition: skip_list.cpp:28
void display() const
Show all saved data.
Definition: queue_using_array.cpp:90
void * searchElement(int key)
Definition: skip_list.cpp:170
void insertElement(int key, void *value)
Definition: skip_list.cpp:90
void clear()
Definition: stack.h:112
constexpr uint16_t max_size
for std::array
Definition: queue_using_array.cpp:22