This is a simple Java application that allows you to sort an array using various sorting algorithms. You can choose the size of the array, whether to generate a random array or input your own, and then select one of the available sorting algorithms. The application will display the sorted array and measure the time taken to perform the sorting.
- Java Development Kit (JDK) installed on your computer.
-
Clone or download this repository to your local machine.
-
Open the project in your preferred Java development environment (e.g., IntelliJ IDEA, Eclipse).
-
Run the Main.java file, which contains the main method to execute the application.
- Run the application, and you will be prompted with the following:
This is a sorting array application!
Please enter the size of the array:
- Enter the size of the array you want to sort.
- You will be asked if you want to generate a random array or input your own:
Do you want to generate a random array? (Y/N)
Your choice:
- If you choose 'Y', a random array will be generated.
- If you choose 'N', you will be prompted to enter the elements of the array.
- The application will display the original array.
- You will be presented with a menu to select a sorting algorithm:
Choose the algorithm you want to use:
1. Bubble Sort
2. Selection Sort
3. Insertion Sort
4. Merge Sort
5. Quick Sort
Your option:
- Enter the number corresponding to the sorting algorithm you want to use.
- The application will display the sorted array using the selected algorithm.
- The time taken to sort the array will also be displayed in nanoseconds.
- The application will terminate, and you can rerun it as needed.
The application supports the following sorting algorithms:
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- This project is a simple example of how to use various sorting algorithms in Java.
- Inspired by the need for understanding and implementing sorting algorithms in real-world applications.