السلام عليكم ورحمة الله
مرحباًأعضاء المنتدى اتمنى تساعدوني باسرع وقت مشكورين
Bubble sort is a simple and one of the well-known sorting algorithms. It sorts an array in an ascending order (from smaller to larger). It works by comparing a pair of values from the begging of the array and swapping only if the value of the current element in the array is larger than the next element.
Example. Sort {7, 3, 12, -4, 20} using bubble sort.
7 3 12 -4 20 unsorted
7 3 12 -4 20 7 > 3, swap
3 7 12 -4 20 7 < 12, Ok
3 7 12 -4 20 12 > -4, swap
3 7 -4 12 20 12 < 20, Ok
3 7 -4 12 20 3 < 7, Ok
3 7 -4 12 20 7 > -4, swap
3 -4 7 12 20 7 < 12, Ok
3 -4 7 12 20 3 > -4, swap
-4 3 7 12 20 3 < 7, Ok
-4 3 7 12 20 -4 < 3, Ok
-4 3 7 12 20 Sorted
Write a function Bubble_sort (int [] array, int array_size) that takes an array of integers along with the size of the array. The function should sort the array.
1. Use this function with the Binary search function (Exercise 1) in one program to sort then search
a. Do a menu having two options 1- Binary search 2- Bubble sort
b. Do a validation to check that the Binary search is performed on a sorted array (user selects option 2 before 1 for the first time
)

