Original post by maggiehodgsonFrom my understanding of a binary search you find the number of element is the list you are going to search and find the middle number in that list.
If the number is less that that, then you know you have to search in the top half of the list and you then make that top half your new list. Otherwise you make the bottom half your new list.
The I and J and N are probably the first element, the last element and the middle element of your current list.
eg. if your ordered list was 1,3,5,7,9,10,12,18,73 and you were searching for number 9
You have 7 elements in the list so you find the middle number INT(9/2) = 4. You find element 4 and it's 7 so it's too small. So you know you have to look in the second half of the list. ie 9,10,12,18,73. This has got 5 element so INT(5/2) = 2 and you look at element 2 in this list. It's 10 which is too big. So you have to look in the top half of that list. That list is 9,10 and so on and so on.
I hope this helps you to decipher the code.