Data structure

Stack In C Programming

Stack In C Programming

In computer science, a stack is a particular kind of abstract data type or collection in which the principal (or only) operations on the collection are the addition of an entity to the collection, known as push and removal of an entity, known as pop. Push And Pop: The relation between the push and pop […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C program to implement Circular Queue operations

C program to implement Circular Queue operations

Below C program implements various Circular Queue operations 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program to implement B-Trees

C++ program to implement B-Trees

#include <iostream.h> #include <stdlib.h> #include <alloc.h> const int MAX = 4 ; const int MIN = 2 ; struct btnode { int count ; int value[MAX + 1] ; btnode *child[MAX + 1] ; } ; class btree { private : btnode *root ; public : btree( ) ; void insert ( int val ) […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program to implement AVL Tree & its Operations

C++ program to implement AVL Tree & its Operations

#include <iostream.h> #include <stdlib.h> #include<constream.h> #define FALSE 0 #define TRUE 1 struct AVLNode { int data ; int balfact ; AVLNode *left ; AVLNode *right ; } ;   class avltree { private : AVLNode *root ; public : avltree( ) ; AVLNode* insert ( int data, int *h ) ; static AVLNode* buildtree ( […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program for creation and traversal of a Binary Tree

C++ program for creation and traversal of a Binary Tree

#include<iostream.h> #include<conio.h> #include<process.h> struct tree_node { tree_node *left; tree_node *right; int data; } ; class bst { tree_node *root; public: bst() { root=NULL; } int isempty() { return(root==NULL); } void insert(int item); void inordertrav(); void inorder(tree_node *); void postordertrav(); void postorder(tree_node *); void preordertrav(); void preorder(tree_node *); }; void bst::insert(int item) { tree_node *p=new tree_node; […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program to implement Queue using Linked Representation

C++ program to implement Queue using Linked Representation

#include <iostream.h> template<class T> class Node { friend LinkedQueue<T>; private: T data; Node<T> *link; }; template<class T> class LinkedQueue { public: LinkedQueue() {front = rear = 0;} // constructor ~LinkedQueue(); // destructor int IsEmpty() const {return ((front) ? 0 : 1);} T First() const; // return first element T Last() const; // return last element […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone

C++ program to implement Hash Table

C++ program to implement Hash Table

#include <iostream.h> #include <stdlib.h> #include<constream.h> template<class E, class K> class HashTable { public: HashTable(int divisor = 11); ~HashTable() {delete [] ht; delete [] empty;} int Search(const K& k, E& e) const; HashTable<E,K>& Insert(const E& e); void Output();// output the hash table void del(E e); private: int hSearch(const K& k) const; int D; // hash function […]

Share on FacebookTweet about this on TwitterDigg thisPin on PinterestShare on LinkedInShare on StumbleUponShare on TumblrShare on Google+Email this to someone