Question: Create 2 D ( 2 - dimensional ) array which has random numbers in the range of between 0 and 2 0 . This array

Create 2D (2-dimensional) array which has random numbers in the range of between 0 and 20. This array must be 5\times 5 matrix. Then, print this 2 D array to the console. After that generate another 2D array which has random numbers in the range of between 0 and 20. Add first and second randomly generated 2 D arrays with each other. This will be your final 2 D array. Sort each element in each layer (rows) by increasing order and return the middle elements for each layer. At the final step use Binary Search Algorithm as we discussed in the lab by doing following rules. Convert your 2D array into the 1D array. Create 1D array to hold your converted array. You will do the binary search process in created 1D array. At the binary search step, you will search the key element based on your school ID. Before searching you must do sorting. (You can use sort function) If your key element is not in your randomly generated array than your code must be print "Element is not found in the array!". If key element is found by binary search algorithm than print the index of your key element. - If your last digit of your student ID is even, take key element as your 2*last digit. (If your ID: 12345678 then your key element will be 2^*8=16)- If your last digit of your student ID is odd, take key element as digit before your last digit. (If your ID: 12345679 then your key element will be 2*7=14)
 Create 2D (2-dimensional) array which has random numbers in the range

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!