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 performs addition operation of 2 polar objects by + operator overloading.

  2. Program of declaration of default arguments during creation of function

  3. Mini Project School Management Application

  4. Program to illustrate the Merge Sort

  5. Program to estimate the value of First Derivative of the function at the given points from the given data using Central Difference Formula

  6. Program to illustrate the use of call-by-refrence method in functions

  7. Program of virtual inheritance that takes input of staff members and performs an operation on it

  8. Program to convert a decimal number into binary, octal and pental code

  9. Program to perform insertion sort

  10. Program to solve the Towers of Hanoi Problem (using Recursive Algorithm)

  11. Program to write macro that obtains the largest of three numbers

  12. Program to illustrate the difference between the use of strcomp, strcmpi and stricmp

  13. Program to print a string char by char using constant pointers to non-constant data

  14. Program that changes an infix expression to a postfix expression according

  15. Program to illustrate the implementation of arrays as a Linear Queue

  16. Program to estimate the value of Third Derivative of the function at the given points from the given data using Central Difference Formula of Order 4

  17. Program to fill a Circle using Scan-Line Circle Fill Algorithm using Polar Coordinates

  18. Program to perform linear sort

  19. Program to illustrate pointers , structure and passing structure pointers to function.

  20. Program to estimate the Integral value of the function at the given points from the given data using Simpsons 1/3 Rule

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