An Algorithm Simulator

An algorithm is a step-by-step set in instructions to perform an operation. There are multitude of algorithm types used for sorting, compression, routing and so on. Here I have taken two of the Sorting algorithms into consideration. Namely, Selection Sorting and Bubble Sorting. This Algorithm simulation application will work as an e-Learning tool for beginners for the algorithm genre. This application will allow the user to input integer values and show how the two specific sorting algorithms will do the sorting. Selection sort is one of the simplest algorithms available, where the sorted part is at the left end, and the unsorted part is at the right. Initially the sorted part is empty and the unsorted part is the entire array. Smallest element is selected from the unsorted array and swapped with the leftmost element and that element becomes part of sorted array. This process continues moving unsorted array boundary by one element to the right. This algorithm is not suitable for large data sets as its average and worst case complexity are of O (n2) where n is the number of elements. 


Bubble sort is a simple sorting algorithm. This sorting algorithm is comparison based algorithm in which each pair of adjacent elements is compared and elements are swapped if they are not in order. This algorithm is not suitable for large data sets as its average and worst case complexity are of O(n2) where n is number of elements. 


Sample Inputs and Outputs :

  • 31, 60, 30, 37, 45 => 30, 31, 37, 45, 60 
  • 31, 60, 30, 37, 45 => 60, 45, 37, 31, 30 
  • 1, 23, 3, 54, 3 => 1, 3, 3, 23, 54 
  • 1, 23, 3, 54, 3 => 54, 23, 3, 3, 1 
  • 65, 96, 72, 0, 83 => 0, 65, 72, 83, 96 
  • Cannot enter decimal values (Restricted)


Comments

Popular posts from this blog

Robotic Process Automation a.k.a RPA

Threats to Information Security and What the Hash you could do about it

What the Hash. A Simple Guide to Hashing