Question: Question 2 Question 1 [12 marks] Given DATA array of integers as in Figure 1, answer question a) and b). index [0] [21 [3] [51

 Question 2 Question 1 [12 marks] Given DATA array of integersas in Figure 1, answer question a) and b). index [0] [21

Question 2

[3] [51 [6] [8] 250 270 135 98 100 125 170 190Figure 1: DATA array a) Name the searching technique suitable to be

Question 1 [12 marks] Given DATA array of integers as in Figure 1, answer question a) and b). index [0] [21 [3] [51 [6] [8] 250 270 135 98 100 125 170 190 Figure 1: DATA array a) Name the searching technique suitable to be performed on the data array in Figure 1. Give the reason to justify your answer. [2 marks] b) What should be done to the DATA array in Figure 1 to reduce the complexity time of the searching process? Explain your answer. [2 marks] Given NUM array of integers as in Figure 2, answer question c), d) and e). index [0] [2] [31 [4] [5] [6] [7] [8] 1 3 5 7 9 11 13 17 19 Figure 2: NUM array c) Perform binary search for searching key 20 on the NUM array in Figure 2. Show the tracing of your search using variables left, right, middle, NUM[middle) and found as shown in the table format below. [3 marks ] left right middle NUM[middle] found d) Perform binary search for searching key 5 on the NUM array in Figure 2. Show the tracing of your search using variables left, right, middle, NUM (middle) and found as shown in the table format below. [3 marks ] left right middle NUM[middle] found e) Discuss the differences between the number of steps and the complexity time when searching for key equals to 19 on NUM array in Figure 2 using binary search and sequential search technique. [2 marks] A compiler need to keep track of a return address of next statement to be executed when return from a function call as well as all parameters passed to the calling function. An example of a program (partial codes) is given in Figure 11, in which a main function calls function A. Function A calls function B, which then calls function C. Bellow are steps for the complier when executing the program: i. the main function calls function A step ii. function A calls function B step iii. function B calls function C step iv. completion of executing function C and returns to function B step V. completion of executing function B and returns to function A step vi. completion of executing function A and returns to main function step address partial code 1000 int main() { 1004 int a, b, c; address 200 204 partial code function Aint a, int b, int c) { int d, e; .... .... 1050 1054 function A(a,b,c); cout

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!