Question: Question 6 ( 3 0 . 0 marks ) Given two unsorted arrays A and B . Array A consists of n numbers of integers

Question 6(30.0 marks)
Given two unsorted arrays A and B. Array A consists of n numbers of integers and array B consists of m numbers of integers. The integers in array B are distinct and they are in the range 1cdotsn. The problem is to output the B[i]th smallest number in array A, for 1im, and mn. For example, let A=[7,3,8,21,5,11] and B=[3,5,1], then the output is 3,7,11 because the sorted array of the elements in array A is 3,5,7,8,11,21 and the first (1st) smallest element of array A is 3, the 3rd smallest element of array A is 7, and the 5th smallest element of array A is 11.
Write two Java, C++, or Python programs to implement the following algorithms:
a) Algorithm 1. Sort array A and Array B and produce the required output.
(10 marks)
b) Write a. report on the analysis of your implementation for Algorithm 1, using the Time or space complexity in terms of function f(n). How much time (number of operations) does Algorithm 1 take?
c) Algorithm 2. Sort array A but do not sort array B. Produce the required output.
d) Write a report on the analysis of your implementation for Algorithm 1, using Time or space complexity in terms of function f(n) How much time (number of operations) does Algorithm 2 take?
Pls give me explanations as well when u
 Question 6(30.0 marks) Given two unsorted arrays A and B. Array

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!