Bubble Sort
1. Which of the following represents a homogeneous array (an array in which all elements are of the same type)?
2. Which of the following arrays is sorted in ascending order?
3. Which of the following is not a sorting algorithm?
4. Consider the following array: A = [-1, 9, 4, 8]. Identify A[2], i.e., the element at index 2, assuming 0-based indexing.
5. Consider the following pseudo-code:
for i = 0 to 2
for j = 0 to i
print "*"
print newline
end Predict the output of the above code.
6. In Bubble Sort, what is the main operation performed on two adjacent elements during a pass?
7. For an ascending Bubble Sort, what happens to the largest element during one complete pass through the unsorted portion of the array?
8. Consider the array A = [5, 2, 4]. What is the array after the first complete pass of Bubble Sort in ascending order?
9. If an array contains N elements, how many adjacent pairs are there when considering the entire array once?