Suppose we are sorting an array of eight integers using quick sort, and we have just finished the first partitioning with the array looking like this:2, 5, 1, 7, 9, 12, 11, 10. Which statement is correct?
Answers
Answer:
Find the nth term of the sequence 3, 8, 13, 18,...
Explanation:
The first six terms of the sequence are 1, 1, 3, 7, 17, 41 …Read more on Sarthaks.com - https://www.sarthaks.com/935371/if-a1-1-a2-1-and-an-2an-1-an-2-n-3-n-n-then-find-the-first-six-terms-of-the-sequence
Suppose we are sorting an array of eight intergers using quick sort, and we have just finished the first partitioning with the array look like this: 2, 5, 1, 7, 9, 12, 11, 10. (A) The pivot could be either the 7 or the 9.
Explanation:
Since the options are as follows
(A) The pivot could be either the 7 or the 9.
(B) The pivot could be the 7, but it is not the 9
(C) The pivot is not the 7, but it could be the 9
(D) Neither the 7 nor the 9 is the pivot.
Sorted array after first partitioning = 2, 5, 1, 7, 9, 12, 11, 10.
Since 7 and 9 are both at there correct places(as if array was sorted). And we can also see that elements less than 7 are placed before 7 and elements bigger than 9 are placed after 8. Therefore, option A is correct the pivot could be either 7 or 9,