10. (10 points) Answer questions (a) - (d) for the method searchList() below: pu
ID: 654487 • Letter: 1
Question
10. (10 points) Answer questions (a) - (d) for the method searchList() below:
public boolean searchList(List list, Node value)
/*
Effects: if list or value are null, throw NullPointerException
else if given Node is in the list, return true else return false
*/
Assume that Node structure has two variables: String Name and int age;
Base your answers on the following characteristic partitioning:
Characteristic: List order
Block 1: List is sorted ascending
Block 2: List is sorted descending
Block 3: List is unsorted
a. Explain what disjointness property means.
b. Explain what completeness property means.
c. Does
Explanation / Answer
a. Two sets are called disjoint if they have no elements in common i.e. the intersection of the sets is the null set.
b. The completeness property states that any non-empty set of real numbers that has an upper bound necessarily has a least upper bound.
c. From the given information, we cannot determine if the List order fails disjoint property or not. In certain cases it may hold true while in other cases it may be false. eg, List order currently does not hold any value, List order passes disjoint property. The second case of disjoint propety will be when List order has values but does not hold the value of the node. eg List order={2,4,5,6,8,9} and node=7. In this case the disjoint property will be true.
If List order={2,4,5,6,8,9} and node=5, the disjoint property will be false in this case.
d. For any set, the numbers has to lie within a range and have the starting value and ending value known as the least upper bound and upperbound, Since the Listorder is a list of real numbers in ascending or descending order, hence it is a complete set.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.