Question
Which sorting algorithm is best suited for a nearly
sorted array, exhibiting O(N) time complexity in its best case?Solution
Insertion Sort performs very well on nearly sorted arrays. In the best case, when the array is already sorted, it only needs to iterate through the array once, performing N-1 comparisons and no swaps, resulting in O(N) time complexity. Other algorithms like Selection Sort, Merge Sort, Heap Sort, and Quick Sort generally do not achieve O(N) for nearly sorted inputs.
Solve the quadratic equations and determine the relation between x and y:
Equation 1: x² - 40x + 300 = 0
Equation 2: y² - 30y + 216 = 0
Solve the quadratic equations and determine the relation between x and y:
Equation 1: 97x² - 436x + 339 = 0
Equation 2: 103y² - 460y + 357 = 0
Solve the quadratic equations and determine the relation between x and y:
Equation 1: 4x² - 12x + 9 = 0
Equation 2: 2y² + 10y + 12 = 0
I. 5x2 – 18x + 16 = 0
II. 3y2 – 35y - 52 = 0
Solve the quadratic equations and determine the relation between x and y:
Equation 1: x² - 30x + 221 = 0
Equation 2: y² - 28y + 189 = 0
I. 35x² - 24x – 35 = 0
II. 72y² - 145y + 72 = 0
I. y/16 = 4/yÂ
II. x3 = (2 ÷ 50) × (2500 ÷ 50) × 42 × (192 ÷ 12)
I. 3q² -29q +18 = 0
II. 9p² - 4 = 0
The roots of x² − (k+3)x + (3k − 1) = 0 are real and distinct, and the larger root exceeds the smaller by 5. Find k.
I. 7x + 8y = 36
II. 3x + 4y = 14