C++ Programming Tutorial

 
 
 

Data File Structure Programs

Array

Insert, edit, delete, append, display, Srch. Insert, delete, merge, delete multiple occurrences Arrays as a Stack in graphics

Stack

Stack operations using array Stack using static memory allocation Stack using dynamic memory allocation Double ended link list as a stack Lnked list as a Stack Infix expr. to Postfix expr. Postfix expr. into an Infix expr. Arrays as a Stack in graphics Stack as an Arithmetic expr. Evaluater Graphical Rep. of Stack Stack to traverse - inodr, postodr, preodr

Queue

Queue using static memory allocation Queue using dynamic memory allocation Circular queue Linked list as a Queue Double Ended linked list as a Queue Graphical Rep. of Queue Arrays as a Linear Queue Array as a Circular Queue Arrays as a Linear Queue ( in graphics ) Arrays as a Circular Queue ( in graphics )

Linked List

Singly link list Circular linked list Doubly link list Linked list as a Queue Linked list as a Stack Double Ended linked list as a Queue Double Ended linked list as a Stack Infix to Postfix - Linked List as Stack Circular doubly link list Single Ended Linked List - Sorting in both odr Hashing - double ended Linked List Sort of link list

Tree

Linked List as a Binary Srch. Tree Set Class using Binary Srch. Tree Maximum depth of Binary Srch. Tree Minimum Spaning Tree Prims algo - minimum spanning tree Traverse binary tree - inodr, preodr, post Find number in binary Srch. tree display levell

Sorting

Bubble Sort Selection Sort Insertion Sort Radix Sort Merge Sort Quick Sort Heap Sort Linear Sort Shell Sort Topological Sort

Searching

Linear Srch. or Sequential Srch. Binary Search Breadth First Search Traversal Depth First Search Traversal Shortest Path-Given Source-Destination-Dijkstras

Hashing

Simple implementation of Hashing Hashing using double-ended Linked List Hashing using Mid-Square Method Example of Hashing n term of the fibonacci series using recursion

Recursion

Factorial of the given number using recursion Mystery of Towers of Hanoi using recursion
 
 

Image

 # include <iostream.h>
 # include <conio.h>

 # define array_size 10

 void radix_sort(long []);


 main( )
    {
       clrscr( );

       long array[array_size]={0};

       cout<<\"\\n ******************************************************************************\"<<endl;
       cout<<\" *********************************  Radix Sort  *******************************\"<<endl;
       cout<<\" ******************************************************************************\"<<endl;

       cout<<\"\\n * Array size = 10\"<<endl;
       cout<<\" * Data Type = long\"<<endl;

       gotoxy(1,24);
       cout<<\" ******************************************************************************\";
       gotoxy(1,25);
       cout<<\" ******************************************************************************\";

       gotoxy(1,10);
       cout<<\" Enter the array : \"<<endl<<endl;

       for(int count_1=0;count_1<array_size;count_1++)
      {
         cout<<\"\\t Element[\"<<count_1<<\"] = \";
         cin>>array[count_1];
      }

       radix_sort(array);

       gotoxy(40,10);
       cout<<\" Sorted Array : \";

       for(int count_2=0;count_2<array_size;count_2++)
      {
         gotoxy(50,12+count_2);
         cout<<\"Element[\"<<count_2<<\"] = \"<<array[count_2]<<endl;
      }

       getch( );
       return 0;

    }



 /***********************  Function Definitions  **************************/




 //------------------------  radix_sort(long [])  ------------------------//


 void radix_sort(long array[])
    {
       int largest_element=array[0];

       for(int count_1=0;count_1<array_size;count_1++)
      {
         if(array[count_1]>largest_element)
        largest_element=array[count_1];
      }

       int maximum_digits=0;
       int temp=largest_element;

       do
      {
         temp/=10;
         maximum_digits++;
      }
       while(temp>0);

       for(int count_2=0;count_2<maximum_digits;count_2++)
      {
         int queue[10][array_size]={0};
         int front[10];
         int rear[10];

         for(int count_3=0;count_3<10;count_3++)
        {
           front[count_3]=-1;
           rear[count_3]=-1;
        }

         for(int count_4=0;count_4<array_size;count_4++)
        {
           int temp=array[count_4];

           for(int count_5=0;count_5<count_2;count_5++)
              temp/=10;

           int significant_digit=temp%10;

           if(rear[significant_digit]==-1)
              {
             rear[significant_digit]=0;
             front[significant_digit]=0;
              }

           else
              rear[significant_digit]++;

           queue[significant_digit][rear[significant_digit]]=
                                  array[count_4];
        }

         int count_6=0;
         int count_7=0;

         do
        {
           if(front[count_7]==0)
              {
             do
                {
                   array[count_6]=queue[count_7][front[count_7]];
                   front[count_7]++;
                   count_6++;
                }
             while(front[count_7]<=rear[count_7]);
              }

           count_7++;
        }
         while(count_6<array_size);

      }
    }

    Related Post:
  1. Program that takes input of counter and displays output of incremented counter using overloading operator++

  2. Program of circular doubly link list with insert, append, delete, copy, reverse and display operations

  3. Program to add two integers without using + operator

  4. Program to construct Newtons Backward Difference Interpolation Formula from the given distinct equally spaced data points

  5. Program that displays checkbox like windows

  6. Program to draw a line using Bresenhams Line Algorithm (BLA) for lines with slopes negative and greater than 1

  7. Program to perform shell sort

  8. Program that provides an example of function returning object

  9. Program to help Umar in this task. Represent each city by one lowercase character. Thus, you can have at most 26 different cities to visit....

  10. Program of Liang Barsky Algorithm for Line Clipping

  11. Program to show the use of Bitwise Operator XOR ( ^ )

  12. Program to show the implementation of None-or-All Character Clipping Strategy (Text Clipping Example)

  13. Program to illustrate the binary operator(-) overloading without creating an object of that class

  14. Program to draw a circle using Trigonometric Method

  15. PROGRAM FOR PASS-I & PASS-II

  16. Program to read a Non-Linear equation in one variable, then evaluate it using Newton-Raphson Method and display its kD accurate root

  17. Program to draw a Cubic Bezier Curve

  18. Program to illustrate the use of reference variables

  19. Program that takes input of students and result obtained, based on that provides rank

  20. Matrix program to display matrix

 
 
Didn't find what you were looking for? Find more on Program to illustrate the Radix Sort