Master fundamental Java concepts with these beginner-friendly programs
A program to implement linear search.
Write a program to implement linear search.
Array: [10, 20, 30, 40, 50], Key: 30
Element found at index 2
A program to implement binary search using iteration.
Write a program to implement binary search using iteration.
Sorted Array: [10, 20, 30, 40, 50], Key: 40
Element found at index 3
A program to implement binary search using recursion.
Write a program to implement binary search using recursion.
Sorted Array: [5, 15, 25, 35, 45], Key: 15
Element found at index 1
A program to implement bubble sort.
Write a program to implement bubble sort.
Array: [5, 3, 8, 1, 2]
Sorted Array: [1, 2, 3, 5, 8]
A program to implement selection sort.
Write a program to implement selection sort.
Array: [29, 10, 14, 37, 13]
Sorted Array: [10, 13, 14, 29, 37]
A program to implement insertion sort.
Write a program to implement insertion sort.
Array: [9, 7, 5, 3, 1]
Sorted Array: [1, 3, 5, 7, 9]
A program to implement merge sort.
Write a program to implement merge sort.
Array: [12, 11, 13, 5, 6, 7]
Sorted Array: [5, 6, 7, 11, 12, 13]
A program to implement quick sort.
Write a program to implement quick sort.
Array: [34, 7, 23, 32, 5, 62]
Sorted Array: [5, 7, 23, 32, 34, 62]
A program to implement counting sort.
Write a program to implement counting sort.
Array: [4, 2, 2, 8, 3, 3, 1]
Sorted Array: [1, 2, 2, 3, 3, 4, 8]
A program to implement heap sort.
Write a program to implement heap sort.
Array: [15, 5, 20, 1, 17, 10, 30]
Sorted Array: [1, 5, 10, 15, 17, 20, 30]