Dynamic Sorting Algorithm Visualizer : Computer Graphics Project

Sorting OpenGL Dynamic Sorting Algorithm Visualizer : Computer Graphics Project for VTU and Other university students for mini projects in CS
Rajeev
Dynamic Sorting Algorithm Visualizer

Project Overview


Sorting can be defined as arranging list, number, or any times in an systematic way in a certain order of sequence having comparable properties. In simple word Sorting  is the process to rearrange the items of a given list in Ascending Order/Descending Order.

Previously in our Computer Graphics Project blog we have discussed about Bucket sort program a sorting program. In that Computer Graphics Project program the user uses to provide two input array to store and show the sorting process and result, while in this project the sorting is show dynamically with Circles representing the input list to sort. 

The project transforms a traditional sorting algorithm into an interactive visual experience. Array elements are represented graphically, allowing users to observe comparisons, swaps, and the gradual formation of the sorted array. The application is designed to make sorting algorithms easier to understand by connecting algorithmic concepts with Computer Graphics and animation.

Project Description


The underlying concept of sorting algorithm includes the comparisons, swapping of elements, and assignments. The DSAV ( Dynamic Sorting Algorithm Visualizer ),  Visualizes the Bubble Sort Algorithm. In this algorithm, comparisons starts from the first two elements of the array and finding the largest item and move (or bubble) it to the top. With each subsequent iteration, find the next largest item and bubble it up towards the top of the array. 

This DSA Visualizer depicts the swapping of elements by swapping the circles (which are the items of the array in our case), for each item different radii of circle is generated according to the value of the item. This swapping process occurs for at the max of n iterations. Thus at the end of nth iteration,  the array of elements are sorted in the ascending order which is the desired output of the DSAV. Below is the logic or say short algorithm of  the Dynamic Sorting Algorithm Visualizer Computer Graphics Project.

Logic of sorting

 
If not in the process of swapping of 2 circles then only get 2 new circles to swap.
    While the counter_i < 10 
        While counter_j <9
            if the a[counter_j] > a[counter_j]
                Swap 2 circles 
                Once exchanged goto swap 
        Increment counter_j 
        Increment counter_i 
Swap: 
 Print which circles are getting swapped. 
 Call swap_circles function again with counter_j and counter_j+1 values. 
 Mark the end of the function sort.

Usages

When you run the program first the window generate will ask your

.'press enter to continue.....' ;

When your press Enter key, new screen will come where Menu appears with instrcutions on what to do below is usage cases for the key.

Following is what keyboard will do after it get pressed -



s : To start sorting
r : To randomizes the sorted list

esc : Exit

Storing will processed in the screen itself until complet or stopped by pressing esc

Technologies Used

  • C/C++ 
  • OpenGL 
  • GLUT/freeGLUT 
  • Computer Graphics 
  • Data Structures and Algorithms

Improvements Over the Original Version

The original concept focuses on visually demonstrating sorting using OpenGL. The improved version extends this concept into a more complete interactive visualization system.

Sorting Algorithms

The improved version can demonstrate several commonly used sorting algorithms: 
  • Bubble Sort — repeatedly compares adjacent elements and swaps them when necessary. 
  • Selection Sort — repeatedly selects the minimum or maximum element and places it in its correct position. 
  • Insertion Sort — builds the sorted array one element at a time. 
  • Merge Sort — recursively divides the array and merges sorted portions. 
  • Quick Sort — partitions the array around a pivot and recursively sorts the resulting portions.

Future Enhancements

Future versions of the project can include: 
  • Additional sorting algorithms 
  • Step-by-step execution mode Keyboard and mouse controls 
  • Interactive GUI menus 
  • 3D visualization 
  • Sound effects for comparisons and swaps 

Project Source Code and Report for the program

Students can Download Full Source code and report for this OpenGL C++ Projects. Students run/execute the program to observe how algorithms behave during execution and understand concepts such as comparisons, swaps, iterations, recursion, and algorithmic complexity through graphical animation.
Dynamic Sorting Algorithm Visualiser.cpp 8.3 KB
DSAV_REPORT.doc 113.5 KB

Video Demo

27 comments

  1. Faizan
    hey rajeev i'm unable to download the report file.. there's no option for downloading in it..can u please help me get the file ??
  2. Rajeev Kumar Singh
    both working well and there is option there, try it
  3. Coolguy
    hi rajeev...
    the program had few errors , cleared it...
    now the program is executing but its stuck at the welcome screen [In Prerss Enter to Continue]
    Please see and help...
    Thanks
  4. Rajeev Kumar Singh
    I have fully tested it and then uploaded so there is no error in program. If there is some error when u run gave a screen shot here in the comment reply
  5. shalini
    pleaz send me the code for this program
  6. shalini
    pleaz send me code for this project
  7. Rajeev Kumar Singh
    download the code from http://adf.ly/7e3fL
  8. Coolguy
    May be the problem is because of conio.h header file.. it wasnt der so i removed that from the program..
    now no errors, the output screen comes.. CLICK ENTER TO CONTINUE.. but the next screen doesnt come..
  9. Rajeev Kumar Singh
    the code is fine and it is well running here, so it will run in ur pc.
    Also try to check the keyboard function, modify it run check again.
    It is quite difficult to help from here as i think the program run quietly if it doesn't i would have not posted it.
  10. Sadia Shariff
    the code is nor working in da exact way it has to work...according to bubble sort...in the first pass that largest element should go to complete right and so on...
  11. Sadia Shariff
    not*
  12. barack
    Please can i have the source code of this project,the link above is not working any more.
  13. barack
    Please i need the source code of this project.please post the link if you have it
  14. Aadya Shetty
    hey plz send me the source code
  15. nilesh
    sir ,the link for download is not working... :( plz can u send the correct link..
  16. Rajeev Kumar Singh
    I have updated the links try again
  17. Ankur Chandrakar
    Please can i have the source code of this project,the link above is not working any more
  18. Ankur Chandrakar
    please can i have the link or source code of this project or path way finding
  19. Rajeev Kumar Singh
    link is working fine
  20. Rajeev Kumar Singh
    that u have to buy!
  21. Rajeev Kumar Singh
    download the file from the links
  22. rohit
    i m not able to download can u please help..its urgent
  23. prathima
    hi sir,
    i need project code for breadth first search in opengl.. its urgent
  24. Rajeev Kumar Singh
    don't ask for urgency
    If you didn't get search google and post your idea so we include them in future.
    Thanks
  25. suraj
    sir i want code for dynamic sorting algoritm for descending order in opengl along with ascending order
  26. Unknown
    Unknown
    This comment has been removed by the author.
  27. Unknown
    Unknown
    Sir, please mail me project abstract and synopsis for dynamic sorting algorithm visualizer.. My mail Id hajiratasneem.m@gmail.com

Join the conversation