Given the ordered list: {2,4,6,8,10,12}
5a) Using binary search,how MANY comparisons would beneeded in order to search for the item 4 in the list? For eachcomparison, write the index and the value of themiddle element (refer to the example below).
Your answer should be written in thefollowing format:-
Comparison 1 :
Middle element index =
Middle element value =
[7 marks]
5b) Suppose we will use sequential search to search foritem 4 in the same list. How many comparisons this willtake?
[1 mark]
Given the ordered list : {2,4,6,8,10,12} 5a) Using binary search, how MANY comparisons would be needed in order to sear
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am