Skip to content

This repo is a demonstration of the time complexity comparison between the ShellSort and the BubbleSort algorithms.

License

Notifications You must be signed in to change notification settings

Dkaban/ShellSort-BubbleSort-Complexity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShellSort vs BubbleSort Execution Time Evaluation

Language: Java

IDE: IntelliJ

This program tests the ShellSort and BubbleSort algorithms in various capacities.

Main Functions To Know

  • ShellSort(T[] data}
  • BubbleSort(T[] data)
  • BubbleSort2(T[] data) Note: BubbleSort2 is an improved algorithm of BubbleSort that kicks out when a swap does not happen.

Tests Run

  • Random Unsorted Array of size 10, 100, 1000
  • Random Sorted Array of size 10, 100, 1000 Note: Adjustable MAX_INTEGER value (most tests were run using 100 as value)

Output

  • Time it takes to run the algorithm using System.nanoTime()
  • Amount of swaps and comparisons made by each algorithm and displaying the updated Arrays as they're sorted.

Swap, Comparison, and Execution Time Output Example:

Main Menu

About

This repo is a demonstration of the time complexity comparison between the ShellSort and the BubbleSort algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages