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 OF BASIC TO CLASS CONVERSION

  2. Program to show the implementation of Linked List as a Binary Search Tree

  3. Program that provides an example of return by reference from functions

  4. Program to show a 3D object using Polygon-Mesh Representation

  5. Program that provides example of dynamic constructor

  6. Program to find largest integer among the three and display it using function with return type

  7. Program to illustrate constant objects and constant member functions

  8. Program to show the implementation of Cohen-Sutherland MidPoint Subdivision Line Clipping Algorithm

  9. Program to illustrate the binary operator(+) overloading without creating a new object

  10. Program to draw a spiral rotating clockwise at the center of the screen

  11. Program of vector class that perform different operations on vector

  12. Program of Deterministic Finite Automation (DFA) for identifier, real number with optional Integer and Fractional Part

  13. Program to find the day of a week of a given date from 15 october 1582 to end of universe using arrays

  14. PROGRAM FOR ACCEPTING MEASUREMENTS IN METERS AND FEETS AND SUMMING THEM UP IN THE FORMAT THAT THE USER WISHES

  15. To parse a string using First and Follow algorithm and LL-1 parser

  16. Program to find whether a year is a leap year or not

  17. Program to read a Linear System of Equations,then evaluate it by using Gauss-Elimination Method and show the result

  18. Program that provides an example of binary files

  19. Program to perform heap sort

  20. Program to construct and display the Divided Difference Table from the given distinct data points.

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