Home / Expert Answers / Advanced Physics / programming-test-3-problem-given-a-numeric-array-a-and-a-numeric-value-n-find-the-linear-index-and-pa183

(Solved): Programming Test 3 Problem Given a numeric array A and a numeric value n find the linear index AND ...




Programming Test 3
Problem
Given a numeric array A and a numeric value n find the linear index AND the value of As element w
Programming Test 3 Problem Given a numeric array A and a numeric value n find the linear index AND the value of A's element whose distance from n is farthest among all the elements (recall that we can linearly index a 2D array just like a 1 column array). A distance between two numbers, say x and y, are measured as the absolute difference between the two IX - Y. Note that the qualifying element may not be unique. In such a case, we want to return the index of the last occuring farthest element that s, the largest index among the farthest elements. Hint. If you coded if-statement correctly, then you don't really need to worry about this at all Examples I Consider the 3x3 array [11, 13, 18, 65, 25, 31:49,65, 371 . 00. The first element (11) is the farthest from n with the distance of 60 - 111 - 49 . 30. The 6th element (65) is the farthest from n with the distance of 30 - 651 = 35. The second element (65) is also the farthest but it's not the last occuring • 38. The 6th element (65) is the farthest from n with the distance of 138 - 65 27. The first and second elements (11 and 65) are also the farthest from (38 - 111 = 27) but they are not the last occuring Task we function for the Element that takes two input arguments in this order an array to be searched and the search key) and returns two output values in this order an index of the last occurring farthest element of the input array and its value) Grading You are allowed unlimited submission while the test is wailable. However, the automatic grader will update Canvas with your last subson, NOT your best submission Ensure that there is enough time to other fix any minor syntax error in your last attempt or revert back to previous testetor solution


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe