subject

Given an unsorted array of distinct integers numbers and is given a non-negative integer number, k, k < n. you need to find an element from a such that its rank is k, i. e., there are exactly (k-1) numbers less than or equal to that element. example: input: a = [1, -3, 4, 3, 12, 20, 30, 7, 14, -1, 0] and k =8. output: 12, since 7, -3, -1, 0, 4, 3, 1 (8-1=7 numbers) are all less than or equal to 12 suggest a sub-quadratic running time complexity algorithm (only pseudo-code) to solve this problem. justify. (b) given an array a of n + m elements. it is know that the first n elements in a are sorted and the last m elements in a are unsorted. suggest an algorithm (only pseudo code) to sort a in o(mlogm +n) worst case running time complexity. justify. (c) the processing time of an algorithm is described by the following recurrence equation (c is a positive constant): t(n) = 3t(n/3) + 2cn; t(1) = 0 what is the running time complexity of this algorithm? justify. (d) you decided to improve insertion sort by using binary search to find the position p where the new insertion should take place. (d.1) what is the worst-case complexity of your improved insertion sort if you take account of only the comparisons made by the binary search? (d.2) what is the worst-case complexity of your improved insertion sort if only swaps/inversions of the data values are taken into account?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Write a loop that prints each country's population in country_pop. sample output for the given program with input 'china: 1365830000,india: 1247220000,united states: 318463000,indonesia: 252164800': united states has 318463000 people. india has 1247220000 people. indonesia has 252164800 people. china has 1365830000 people.
Answers: 2
question
Computers and Technology, 22.06.2019 10:00
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
question
Computers and Technology, 22.06.2019 15:00
Which of the following has not been attributed at least in part to social media a. drug addiction b. depression c. kidnapping d. murder
Answers: 2
question
Computers and Technology, 22.06.2019 22:10
Asequential circuit contains a register of four flip-flops. initially a binary number n (0000 ≤ n ≤ 1100) is stored in the flip-flops. after a single clock pulse is applied to the circuit, the register should contain n + 0011. in other words, the function of the sequential circuit is to add 3 to the contents of a 4-bit register. design and implement this circuit using j-k flip-flops.
Answers: 1
You know the right answer?
Given an unsorted array of distinct integers numbers and is given a non-negative integer number, k,...
Questions
question
History, 17.09.2019 06:30
question
Arts, 17.09.2019 06:30