Loop invariant of linear search

前端 未结 7 1880
醉梦人生
醉梦人生 2021-01-31 09:16

As seen on Introduction to Algorithms (http://mitpress.mit.edu/algorithms), the exercise states the following:

Input: Array A[1..n] and a v

7条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 09:42

    After you have looked at index i, and not found v yet, what can you say about v with regard to the part of the array before i and with regard to the part of the array after i?

提交回复
热议问题