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>

 void swap(long &,long &);
 void quick_sort(long [],int,int);


 main( )
    {
       clrscr( );

       const int array_size=10;

       long array[array_size]={0};

       cout<<\"\\n ******************************************************************************\"<<endl;
       cout<<\" ********************************  Quick 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];
      }

       quick_sort(array,0,array_size-1);

       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  **************************/




 //--------------------------  swap(long,long)  --------------------------//


 void swap(long &element_1,long &element_2)
    {
       long temp=element_1;
       element_1=element_2;
       element_2=temp;
    }


 //--------------------  quick_sort(long [],int,int)  --------------------//


 void quick_sort(long array[],int first,int last)
    {
       if(first>=last)
      {  }

       else
      {
         int middle=array[last];
         int count_1=first-1;
         int count_2=last;

         while(count_1<count_2)
        {
           do
              {
             count_1++;
              }
           while(array[count_1]<middle);

           do
              {
             count_2--;
              }
           while(count_2>=0 && array[count_2]>middle);

           if(count_1<count_2)
             swap(array[count_1],array[count_2]);
        }

         swap(array[count_1],array[last]);

         quick_sort(array,first,count_1-1);
         quick_sort(array,count_1+1,last);
      }
    }

    Related Post:
  1. Program to illustrate operator overloading from class to basic type

  2. Program to illustrate the implementation of arrays as a Stack

  3. Program to calculate distance summation, subtraction, multiplication and comparison using overloading operators also make it friend functions

  4. To parse a string using Recursive-Descent parser

  5. Program that uses this DFA and validates whether an entered string is valid float or not

  6. Program to illustrate the implementation of Scaling Transformation along a Fixed Point

  7. Program for using enum

  8. Program that provides an example of functions with default arguments

  9. Program that take font and background color and text input from a user and display it in center aligned

  10. Program to open file

  11. Program that take font and background color and text input from a user and display it in right aligned

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

  13. Perform insert, delete, merge and delete multiple occurrences of a number from an array

  14. Program of Minimum Spaning Tree ( MST )

  15. Program to maintain employee information also illustrate virtual class and inheritance

  16. Program to implement the Kurskals Algorithm to solve Minimum Cost Spanning Tree Problem (MST) using Graphics

  17. Program to illustrate friend function

  18. Program to illustrate the 2D array of int using pointers

  19. Program to illustrate the use of pointer this using header file this.h

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

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