Software Testing question Answer urgently needed within 1 ho

Software Testing question. Answer urgently needed (within 1 hour)! Thank you! I need answer for (c) because I cannot think of any good answer.

1. Answer the following questions for the method search() below: public static int search (List list, 0bject element) Effects: if list or element is null throw NullPointerException. else if element is in the list, return an index of element in the list; else return -1 for example, search (13,3,1], 3) either 0 or 1 search (1,7,5], 2) --1 Base your answer on the following characteristic partitioning Characteristic: Location of element in list Block 1: element is first entry in list Block 2: element is last entry in list Block 3: element is in some position other than first or last (a) \"Location of element in list\" fails the disjointness property. Give an ex- ample that illustrates this. (b) \"Location of element in list\" fails the completeness property. Give an example that illustrates this. (c) supply one or more new partitions that capture the intent of \"Loca tion of e in list\" but do not suffer from completeness or disjointness problems.

Solution

C : To capture the intent of \"Location of e in list\" you can use the below modified search technique

mid = Lo + ((Hi - Lo) / (A[Hi] - A[Lo])) * (X - A[Lo])

where
A = list
Lo = Lowest index of the list
Hi = Highest index of the list
A[n] = Value stored at index n in the list

Software Testing question. Answer urgently needed (within 1 hour)! Thank you! I need answer for (c) because I cannot think of any good answer. 1. Answer the fol

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site