Algorithm: BINSEARCH(DATA, ITEM) Set BEG = 0, END = N-1 and MID = INT((BEG + END) / 2) Repeat steps 3 and 4 while BEG


Algorithm: BINSEARCH(DATA, ITEM)



  1. Set BEG = 0, END = N-1 and MID = INT((BEG + END) / 2)

  2. Repeat steps 3 and 4 while BEG <= end="" and="" data[mid]="" !="">

  3. If ITEM < data[mid],="" then="" set="" end="MID" –="" 1,="" else="" set="" beg="MID" +="">

  4. MID = INT((BEG + END) / 2)

  5. If DATA[MID] = ITEM, then Set LOC = MID Else Set LOC = NULL

  6. Exit




Q: Run the above algorithms A2 in C++



Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here