-
Binary Tree
Binary tree in C++
Simple, may not be the best implementation there is. Contains functions for inserting, deleting, finding the next and previous values, checking if a node is a leaf, printing, searching, counting the number of nodes, etc.
Also contains a main with examples. Nice for beginners.
-
Doubly linked list algorithm in C++
Doubly linked list in C++. A simple implementation that includes a few simple features:
Adding a node, erasing a node, searching a node, counting the number of nodes in the list, printing the list by a recursive function, printing the list iteratively and printing the list in reverse order.
The nodes hold only integers as data but this can be generalized easily.
-
Graph data structure
Graph is a data structure used in many algorithms. It's vertices are represented by a separate class, Vertex. There is a data (Object type) field in vertex class, which can be used to store any data. Vertex class can be modified to hold any information (e.g. Student, Account, etc.) by using the example.
-
Binary Heap
Binary heap is a tree type data structure. It has all the properties of binary search trees including the following ones-
1) All the levels of the binary tree must be filled except the last one. Levels are filled from left to right order. This property is known as shape property.
2) Each node's value must be less than or equal to all it's child nodes values [for min-heap]. Or, Each node's value must be greater than or equal to all it's child nodes values [for max-heap]. This property is known as heap property.
-
Binary Search Tree (BST) in Java
Binary search tree is a tree type data structure. Each node can have at most two immediate children. Binary search tree (BST) also have some special properties- 1) For any node, the node value will be greater than the values of all the nodes of the left subtree (if any). 2) For any node, the node value will be less than (or equal to) the values of all the nodes of the right subtree (if any). 3) For any node, it's left and right subtrees (if any) will also be binary search trees.
Here is an implementation example of BST in Java.
-
Queue demo in Java
Queue is a FIFO (First In First Out) type data structure. The first item to enter queue always comes out of the queue first. In queue, data is inserted (enqueue) in its "rear" and extracted (dequeue) from its "front".
Here is an implementation of queue using Java. It stores integer type data. It's simple and easy to understand.
-
Single Sided Linked List in Java
Singly linked list (also known as, linked list) is a data structure that serves the purpose of a dynamic array. Every item in that list contains two parts- data, and pointer to next item. The first item is pointed by a pointer known as "head". And, the last item has "null" to its next, which means the end of list.
There can various of methods in a linked list, such as- goFirst(), insert(), remove(), etc. Here is an implementation of linked list in Java with basic functionality. It can hold integer type data.
-
Stack in Java
Stack is a LIFO (Last In First Out) type data structure. The last item to enter stack always comes out of the stack first. This data structure is very useful in implementing many algorithms.
Here is an implementation of stack using Java. It stores integer type data so it's a very simple implementation. Good as a tutorial for data structures 101.
-
Doubly Linked List in Java
Doubly linked list is a data structure that serves the purpose of a dynamic array. Every item in that list contains three parts- data, pointer to next item and pointer to previous item. The first and last items are pointed by pointers known as "head" and "tail" respectively. The last item has "null" to its next, which means the end of list. Similarly, the first item has "null" to its previous, which means starting of the list. Unlike singly linked list, this list is able to move in both forward and backward direction.
