* procedure Search (Key : ELEM ; T: ELEM_ARRAY; Found : in out BOOLEAN; L: in out ELEM_INDEX) ; Pre-condition -陣列至少有一個元素(T’FIRST = T’LAST ) Post-condition - 元素被找到,L是索引 ( Found and T (L) = Key) 或 - 元素不在陣列中 ( not Found and not (exists i, T’FIRST = i = T’LAST, T (i) = Key )) 等價劃分範例- Search * 輸入資料等價劃分,第一類 符合前置條件 陣列有一個元素 陣列有多個元素 不符合前置條件 陣列長度為 0 輸入資料等價劃分,第二類 Key element 在陣列 找到方式:First, Middle, Last Key element 不在陣列 等價劃分範例- Search * 輸入資料等價劃分,案例設計 陣列長度為 0 陣列有一個元素,Key element 在陣列中 陣列有一個元素,Key element 不在陣列中 陣列有多個元素,Key element 在陣列的 First 陣列有多個元素,Key eleme

文档评论(0)

1亿VIP精品文档

相关文档