C++ program to add two polynomials maintained using Linked Lists

Thursday, February 3rd, 2011  »  Posted By Ranjith  »  Total 1 Comment

#include <iostream.h> class poly { private : struct polynode { float coeff ; int exp ; polynode *link ; } *p ; public : poly( ) ; void poly_append ( float c, int e ) ; void display_poly( ) ; void poly_add( poly &l1, poly &l2 ) ; ~poly( ) ; } ; poly :: [...]

java program for Client-Server Program using TCP/IP

Wednesday, February 2nd, 2011  »  Posted By Ranjith  »  Total 0 Comment

Program : Client-Server Program using TCP/IP By : Kapil Lohia import java.net.*; import java.io.*;   class tcpip_server { public static void main(String args[]) throws IOException { ServerSocket n1=null; try { n1=new ServerSocket(98); } catch(IOException e) { System.err.println("Port 98 could not be found"); System.exit(1); } Socket c=null; try { c=n1.accept(); System.out.println("Connection from "+c); } catch(IOException e) [...]

C++ program to implement B-Trees

Wednesday, February 2nd, 2011  »  Posted By Ranjith  »  Total 5 Comments

#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 ) [...]

C++ program to implement AVL Tree & its Operations

Wednesday, February 2nd, 2011  »  Posted By Ranjith  »  Total 2 Comments

#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 ( [...]

C++ program to implement Binary Search Tree(BST) and its Operations

Wednesday, February 2nd, 2011  »  Posted By Ranjith  »  Total 0 Comment

#include <iostream.h> class btree { private : struct node { node *left ; char data ; node *right ; } *root ; char *arr ; int *lc ; int *rc ; public : btree ( char *a, int *l, int *r, int size ) ; void insert ( int index ) ; static node* buildtree [...]

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

Wednesday, February 2nd, 2011  »  Posted By Ranjith  »  Total 2 Comments

#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; [...]

C++ program to implement circular queue using array

Wednesday, February 2nd, 2011  »  Posted By Ranjith  »  Total 0 Comment

#include <iostream.h> class cqueue { private : int *arr ; int front, rear ; int MAX; public : cqueue( int maxsize = 10 ) ; void addq ( int item ) ; int delq( ) ; void display( ) ; } ; cqueue :: cqueue( int maxsize ) { MAX = maxsize ; arr = [...]

C++ program to implement Heap sort Algorithm

Tuesday, February 1st, 2011  »  Posted By Ranjith  »  Total 4 Comments

#include <iostream.h> const int MAX = 10 ; class array { private : int arr[MAX] ; int count ; public : array( ) ; void add ( int num ) ; void makeheap(int ) ; void heapsort( ) ; void display( ) ; } ; array :: array( ) { count = 0 ; for [...]

C++ program to implement Quick sort Algorithm using class

Tuesday, February 1st, 2011  »  Posted By Ranjith  »  Total 2 Comments

#include <iostream.h> const int MAX = 10 ; class array { private :   int arr[MAX] ; int count ; public :   array( ) ; void add ( int item ) ; int getcount( ) ; static int split ( int *, int, int ) ; void quiksort ( int lower, int upper ) [...]

C++ rogram to implement merge sort

Tuesday, February 1st, 2011  »  Posted By Ranjith  »  Total 0 Comment

#include <iostream.h> const int MAX = 5 ; class array { private : int *a ; int size ; int count ; public : array( ) ; array ( int sz ) ; void add ( int num ) ; void display( ) ; void merge_sort(int low,int high); void merge(int low,int mid,int high); ~array( ) [...]

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup