Skip to content

sgowda97/sorting-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sorting-java

Different kinds of sorting programs in Java

HOW-TO:

  • Make sure JDK is installed.
  • After downloading, go into the directory of the sorting program you'd like to use
  • Assuming you want to use bubble sort, while in the directory in CLI, type:
    • javac BubbleSort.java
    • java BubbleSort
  • Follow the instructions.

Bubble Sort

  • Known as the simplest sorting program
  • Array is traversed from first element to last element
  • Current element is compared with next element, if the current element is greater than next element, it is swapped

Selection Sort

  • Divides the array into two
    • Sorted array
    • Unsorted array
  • Checks the entire array for the minimum element and places it at the beginning of the sorted list and so on

Insertion Sort

  • Only good for smaller arrays, because it takes lots of time
  • Transfers one element at a time to the right position

About

Different kinds of sorting programs in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages