Question: Question 10 (5 points) Your code is using a symbol table of type BinarySearchST . What methods must be defined in classes Account and/or

Question 10 (5 points) Your code is using a symbol table oftype BinarySearchST . What methods must be defined in classes Account and/orTransactions in order for the symbol table to work correctly? The Accountclass must define the method public int compareTo(obect other) The Account classmust define the method public int compareTo(Account other) and the Transactions class

Question 10 (5 points) Your code is using a symbol table of type BinarySearchST . What methods must be defined in classes Account and/or Transactions in order for the symbol table to work correctly? The Account class must define the method public int compareTo(obect other) The Account class must define the method public int compareTo(Account other) and the Transactions class must define the method public boolean equals(Transactions other) The Account class must define the method public int compareTo(Account other) The Account class must define the method public int compareTo(Object other) and the Transactions class must define the method public boolean equals(Object other) Question 11 (5 points) Assume the contents of the keys array of a BinarySearchST are as depicted below. Trace the execution of a call to rank(55) by listing out the sequence of values that are assigned to the variable mid in the book's code (given below the array). List out the mid values with commas separating the values. For example, if you thought the values of mid took on the values 8 through 5 in decreasing order, you would write 8,7,6,5 0 1 2 3 4 5 6 7 8 9 4 12 33 38 50 53 61 72 7494 public int rank (Key key) { int loe, hi = n-1; while (lo e) lomid + 1; else return mid; return 10; } } Question 12 (5 points) Assume the contents of the keys array of a BinarySearchST are as depicted below. What value is returned by rank(100)? 0 1 2 3 4 5 6 7 8 9 4 12 33 38 50 53 61 72 7494 public int rank (Key key) { int loe, hi = n-1; while (lo e) lomid + 1; else return mid; } return lo; } -1 An exception is thrown 9 10 Question 8 (5 points) What is the order of growth of the worst case running time of the put operation for the book's BinarySearchST with n keys, when the key being inserted is already in the symbol table? constant O(1) linear O(n) logarithmic O(lg n) quadratic O(n) Question 9 (5 points) What is the order of growth of the worst case running time of the put operation for the book's BinarySearchST with n keys, when the key being inserted is not already in the symbol table? quadratic O(n) logarithmic O(Ign) constant O(1) linear O(n)

Step by Step Solution

3.48 Rating (148 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below question 10 The correct answer is 1 The Account class must define the method public int compareToAccount other 2 The Transactions class mus... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!