Question: 3. (10 pts) Develop an algorithm that computes the k-th smallest element of an n-element sequence of distinct integers in O(n + klgn) time. Please

3. (10 pts) Develop an algorithm that computes the k-th smallest element of an n-element sequence of distinct integers in O(n + klgn) time. Please - 1) Describe the algorithm in pseudocode; 2) Justify that your algorithm runs in O(n + klgn). Requirements: 1) you may move the elements around within the heap but are not allowed to delete existing elements from the heap or add new elements to the heap during the process. 2) You may either use a min-heap or max-heap. Point out what kind of heap you use
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
