> in question #4 the "...first number that is smaller than its > predecessor...," answer D, puzzles me: > > for (i = 1; list[i-1] <= list[i]; i++) //starts at index is 1 and seeks a > number less than OR EQUAL TO its predecessor > > What about index is 0, and why equal to as well as less than?
These questions can be treacherous and confusing. (The Dutch word is "geniepig") for (i = 1; list[i-1] <= list[i]; i++) == Start at index i=1, and _continue_ walking as long as list[i] >= list[i-1] So, stop, as soon as list[i] < list[i-1], which is exactly what we were looking for. > And in question 10, that binary search diagram looks down to the left for > greater than and down to the right for less than the previous node. > Therefore, I had identified the node containing 1 as less than the previous > node containing value 4 and expected a search down to the right for less > than and down to the left foe greater than(?). [Right answer for question 10 is C] Question 10 was about a (general) binary tree, not about a binary search tree (or sorted binary tree)! Please be careful not to assume that all binary trees are search trees... Hans
