Page 1 of 1

6. (13 pts) Let X
Posted: Fri May 20, 2022 1:46 pm
by answerhappygod
6 13 Pts Let X X2 X Be An Array Of Integers In Increasing Order We Need To Determine If Any X I Finding 1
6 13 Pts Let X X2 X Be An Array Of Integers In Increasing Order We Need To Determine If Any X I Finding 1 (95.73 KiB) Viewed 49 times
Pseudo Code Please!!
6. (13 pts) Let X<X2 < ... <X, be an array of integers in increasing order. We need to determine if any X; = i, finding such a value of i if one exists. (Return any i if one or more exists, otherwise return 0) (a) (2 pts) What is the answer for the following input instance? X X2 X3 X4 X5 X X -4 -1 1 3 4 5 12 (b) (2 pts) What is the answer for the following input instance? X1 X2 X3 X4 X5 X6 -4 -2 0 3 5 7 (c) (7 pts) Give the best (with the lowest worst-case complexity) algorithm that you can think of for this problem. Justify the correctness.