Suppose you have two arrays: Arr1 and Arr2. Arrl will be sorted values. For each element v in Ar2, you need to write a pseudo code that will print the number of elements in Arrl that is less than or...


Write code inJava orPython


Suppose you have two arrays: Arr1 and Arr2.<br>Arrl will be sorted values. For each element v in Ar2, you need to write a pseudo code that will<br>print the number of elements in Arrl that is less than or equal to v.<br>For example: suppose you are given two arrays of size 5 and 4 respectively.<br>5 4 [size of the arrays]<br>Arrl = 1 3 5 79<br>Arr2 = 6 4 8<br>The output should be 3 2 4<br>Explanation: Firstly, you should search how many numbers are there in Arrl which are<br>less than 6. There are 1, 3, 5 which are less than 6 (total 3 numbers). Therefore, the answer<br>for 6 will be 3.<br>After that, you will do the same thing for 4 and 8 and output the corresponding answers<br>which are 2 and 4. Your searching method should not take more than O (log n) time.<br>Sample Input<br>55<br>Sample Output<br>42425<br>11225<br>31415<br>

Extracted text: Suppose you have two arrays: Arr1 and Arr2. Arrl will be sorted values. For each element v in Ar2, you need to write a pseudo code that will print the number of elements in Arrl that is less than or equal to v. For example: suppose you are given two arrays of size 5 and 4 respectively. 5 4 [size of the arrays] Arrl = 1 3 5 79 Arr2 = 6 4 8 The output should be 3 2 4 Explanation: Firstly, you should search how many numbers are there in Arrl which are less than 6. There are 1, 3, 5 which are less than 6 (total 3 numbers). Therefore, the answer for 6 will be 3. After that, you will do the same thing for 4 and 8 and output the corresponding answers which are 2 and 4. Your searching method should not take more than O (log n) time. Sample Input 55 Sample Output 42425 11225 31415

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here