1) First Call: search(a, 0, 4, 876)
a) Calculate the middle index: (i) m = (0 + 4) // 2 = 2
b) Compare a[m] with item: (i) a[2] = 123 (ii) Since 123 < 876, search the right half: (iii) Call: search(a, 3, 4, 876)
2) Second Call: search(a, 3, 4, 876)
a) Calculate middle index: (i) m = (3 + 4) // 2 = 3
b) Compare a[m] with item: (i) a[3] = 234 (ii) Since 234 < 876, search the right half: (iii) Call: search(a, 4, 4, 876)
3) Third Call: search(a, 4, 4, 876)
a) Calculate the middle index: (i) m = (4 + 4) // 2 = 4
b) Compare a[m] with item: (i) a[4] = 876 (ii) Since 876 == 876, return 'true'.
1) The third call returns 'true' back to the second call.
2) The second call also returns 'true' back to the first call.
3) Finally, the first call returns 'true', which is stored in b.
The output will be: true
User input
There are three options for entering the input.
1) Fixed Data (Number 1 in the above image): If you click on the "Fixed Data" button, the program runs with predefined input.
2) Use Random (Number 2 in the above image): This option allow the user to save time and the input values are generated and given by the system.
3) User Input (Number 3 in the above image): This option allows the user to enter their input in the given text boxes, and the program will continue on your input.
Simulation play buttons
1) Number 4 in the above image: This button is used to draw the final result in the graph area.
2) Number 5 in the above image: This button is used to draw graph step by step in forward direction.
3) Number 6 in the above image: This button is used to draw graph step by step in backward direction.
Refresh
1) Number 7 in the above image: This button is used to refresh the simulation.
Instruction
1) Number 8 in the above image: This button is used to show some instructions about the purpose of the simulation.
Help
1) Number 9 in the above image: This button is used to show the users how to do the simulation.
Fullscreen and minimized screen
1) Number 10 in the above image: This button is used for maximizing or minimizing the simulation screen.