Algorithms_in_C++  1.0.0
Set of algorithms implemented in C++.
cll.h
1 /*
2  * Simple data structure CLL (Cicular Linear Linked List)
3  * */
4 #include <cctype>
5 #include <cstdlib>
6 #include <cstring>
7 #include <iostream>
8 
9 #ifndef CLL_H
10 #define CLL_H
11 /*The data structure is a linear linked list of integers */
12 struct node {
13  int data;
14  node* next;
15 };
16 
17 class cll {
18  public:
19  cll(); /* Construct without parameter */
20  ~cll();
21  void display(); /* Show the list */
22 
23  /******************************************************
24  * Useful method for list
25  *******************************************************/
26  void insert_front(int new_data); /* Insert a new value at head */
27  void insert_tail(int new_data); /* Insert a new value at tail */
28  int get_size(); /* Get total element in list */
29  bool find_item(int item_to_find); /* Find an item in list */
30 
31  /******************************************************
32  * Overloading method for list
33  *******************************************************/
34  int operator*(); /* Returns the info contained in head */
35  /* Overload the pre-increment operator.
36  The iterator is advanced to the next node. */
37  void operator++();
38 
39  protected:
40  node* head;
41  int total; /* Total element in a list */
42 };
43 #endif
mov
void mov(tower *From, tower *To)
Definition: tower_of_hanoi.cpp:39
graph
Definition: bfs.cpp:3
std::vector
STL class.
deleteNode
node * deleteNode(node *root, int key)
Definition: avltree.cpp:88
std::vector::size
T size(T... args)
MinHeap::deleteKey
void deleteKey(int i)
Definition: binaryheap.cpp:105
MinHeap
Definition: binaryheap.cpp:10
MinHeap::heap_size
int heap_size
Current number of elements in min heap.
Definition: binaryheap.cpp:13
node
Definition: avltree.cpp:13
node
struct list node
MinHeap::decreaseKey
void decreaseKey(int i, int new_val)
Definition: binaryheap.cpp:76
levelOrder
void levelOrder(node *root)
Definition: avltree.cpp:119
std::queue
STL class.
MinHeap::insertKey
void insertKey(int k)
Definition: binaryheap.cpp:55
createNode
node * createNode(int data)
Definition: avltree.cpp:21
cll
Definition: cll.h:17
MinHeap::capacity
int capacity
maximum possible size of min heap
Definition: binaryheap.cpp:12
insert
node * insert(node *root, int item)
Definition: avltree.cpp:66
std::printf
T printf(T... args)
std::cout
h
int h(int key)
Definition: hash_search.cpp:45
k
ll k
Definition: matrix_exponentiation.cpp:48
MinHeap::harr
int * harr
pointer to array of elements in heap
Definition: binaryheap.cpp:11
MinHeap::MinHeapify
void MinHeapify(int)
Definition: binaryheap.cpp:113
height
int height(node *root)
Definition: avltree.cpp:31
rightRotate
node * rightRotate(node *root)
Definition: avltree.cpp:41
endl
#define endl
Definition: matrix_exponentiation.cpp:36
MinHeap::left
int left(int i)
Definition: binaryheap.cpp:31
std::swap
T swap(T... args)
std::min
T min(T... args)
data
int data[MAX]
test data
Definition: hash_search.cpp:24
minValue
node * minValue(node *root)
Definition: avltree.cpp:59
queue::front
Kind front()
Definition: queue.h:61
queue
Definition: queue.h:17
std::endl
T endl(T... args)
MinHeap::MinHeap
MinHeap(int cap)
Definition: binaryheap.cpp:19
std
STL namespace.
main
int main()
Definition: avltree.cpp:134
std::max
T max(T... args)
leftRotate
node * leftRotate(node *root)
Definition: avltree.cpp:50
std::cin
MinHeap::getMin
int getMin()
Definition: binaryheap.cpp:43
std::vector::data
T data(T... args)
getBalance
int getBalance(node *root)
Definition: avltree.cpp:38
Queue
Definition: binary_search_tree.cpp:17
MinHeap::extractMin
int extractMin()
Definition: binaryheap.cpp:85
MinHeap::right
int right(int i)
Definition: binaryheap.cpp:34