2 20 Points Let List N Necessarily Distinct Integers Describe N Algorithm Test Whether Ite Q37105834

2. (20 points) Let A be a list of n (not necessarily distinct) integers. Describe a (n) algorithm to test whether any item ap

2. (20 points) Let A be a list of n (not necessarily distinct) integers. Describe a (n) algorithm to test whether any item appears more than [n/2] times in A. Call your function Test, write down its pseudo code and explain why the run time is e(n). Hint: Note that if an element occurs more thană€Œn/2] times in A, it must be median of A (why?). You can use the “black-box” subroutine from

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.