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

//Shell Sort

#include <iostream.h>
#include <conio.h>
#define MAX 10

class shellsort{
    int arr[MAX],n;
    public:
    void getdata();
    void showdata();
    void sortLogic();
};

void shellsort :: getdata(){
    cout<<\"How many elements you require : \";
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>arr[i];
}

void shellsort :: showdata(){
    cout<<\"\\n--Display--\\n\";
    for(int i=0;i<n;i++)
        cout<<arr[i]<<\"   \";
}

void shellsort :: sortLogic(){
    int i,j,temp,increment;

    for(increment=n/2; increment>0; increment /= 2){
        for(i=increment; i<n; i++){
            temp=arr[i];
            for(j=i; j>=increment; j -= increment){
                if(temp < arr[j-increment])
                    arr[j] = arr[j-increment];
                else
                    break;
            }
            arr[j] = temp;
        }
    }
}

void main(){
    clrscr();
    cout<<\"\\n*****Shell Sort*****\\n\";
    shellsort obj;
    obj.getdata();
    obj.sortLogic();
    obj.showdata();
    getch();
}

    Related Post:
  1. Program that takes short date from a user and displays long date

  2. Program to estimate the value of Fourth Derivative of the function at the given points from the given data using Central Difference Formula of order 2

  3. Program of Minimum Spaning Tree ( MST )

  4. Program to reverse the sequence of the words in the sentence and display the result

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

  6. Program to illustrate the implementation of 3D Rotation Transformation along z-axis

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

  8. Program to add two integers without using + operator

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

  10. Program to show the 3D Shearing Transformation along z-axis

  11. Program to illustrate an example of Polymorphism ( Pure Virtual functions ).

  12. Program that reads marks obtained by a student in a test of 100 marks and print pass if marks are greater than or equal to 50

  13. Program that prints all the even numbers b/w 0 to 50 ( using while, do-while and for loop )

  14. Program that provides an example to return an object from a function

  15. Program of Boundary Fill (8 Connected Point).

  16. Program of KSCANNER

  17. Program to convert points to rectangle coordinates and polar coordinates

  18. Program of stack to traverse in inorder, postorder and preorder

  19. Program to convert an Infix Expression into a Postfix Expression using Linked List as a Stack

  20. Program of traversing a binary tree in inorder iteratively

 
 
Didn't find what you were looking for? Find more on Program to perform shell sort