CENG 383 - Midterm - 2024 - 2025 - Fall
CENG 383 - Midterm - 2024 - 2025 - Fall
2 5 8 12 18 22 27
4 7 11 15 20 26 30
6 10 14 19 24 28 33
8 13 17 22 27 31 36
10 16 21 25 30 34 39
12 18 23 28 32 37 42
14 20 26 31 36 40 45
Write the pseudocode for a function binarysearch2d which locates a target entry in the array and returns the location.
Your algorithm should use a 2D version of binary search.
Hint: In the above example, the middle entry is 22 (at position A[3][3], corresponding to the 4th row and 4th column in
1-based indexing).
Master Theorem