For the first question, when I trace with i = 2, I do not know how to continue because list [3] when the length of the array is 3 [2,4,9] ?
Notice the test in the for-loop is i < list.length - 1. If the array is [2, 4, 9], then list.length is 3 and list.length - 1 is 2. If i = 2, then test is 2 < 2 which is false so the loop body is not executed when i = 2.