Skip to content

Cian99/java-sorting-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Java Sorting Algorithms

This repository contains two Java programs that implement sorting algorithms: Selection Sort and Quick Sort. These programs allow users to input an array of integers, which is then sorted using the respective algorithm.

Input: Each program prompts the user to input the size of the array and the array elements.

Output: The programs display the unsorted array and the sorted array.

Selection Sort

  • Algorithm: Iterates through the array, selecting the smallest unsorted element and swapping it with the current element. The process repeats for all elements.
  • Time Complexity: O(n²) — less efficient on large lists.

Quick Sort

  • Algorithm: A divide-and-conquer sorting method. It selects a pivot, partitions the array into elements less than and greater than the pivot, and recursively sorts the partitions.
  • Time Complexity: O(n log n) on average — generally more efficient than Selection Sort.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages