Consider the task of searching a sorted array A[1 . . . n] for a… Consider the task of searching a sorted array A[1 . . . n] for a given e

Consider the task of searching a sorted array A[1 . . . n] for a… Consider the task of searching a sorted array A[1 . . . n] for a given element x: a task we usuallyperform by binary search in time O(log n). Show that any algorithm that accesses the array onlyvia comparisons (that is, by asking questions of the form “is A[i] ? z?”), must take ?(log n) steps.2.19. A k-way merge operation. Suppose you have k sorted arrays, each with n elements, and you wantto combine them into a single sorted array of kn elements.(a) Here’s one strategy: Using the merge procedure from Section 2.3, merge the first two ar-rays, then merge in the third, then merge in the fourth, and so on. What is the timecomplexity of this algorithm, in terms of k and n?(b) Give a more efficient solution to this problem, using divide-and-conque  Explain the meaning  volatile modifier. Explain whether or notyou need to use it with your new implmentation of getNext. [2 marks](b) The following method is intended to implemnt a barrier for synchronizationbetween four threads. The first three threads to call the barrier method aremeant to block. These threads are all unblocked when the fourth call is made.int barrierCount = 0;void synchronized barrier() throws InterruptedException {barrierCount ++;if (barrierCount < 4) {wait();} else {   Create a data frame called babyanth.complete that contains the complete cases.b. Calculate Pearson's correlation coefficient (??) between the variables Weight and Head in the babyanth.complete data frame using the following formula. Include the correlation value you calculated in a comment.??=?(???????????????????????????????????)(??????????????????????????)????=1??(???????????????????????????????????)2????=1??(??????????????????????????)2????=1In the above equation,• ?? is the number of babies or rows in the babyanth data frame• ?? = 1,2,3,....?? and indexes each row or baby in the data frame????????????? and ????????? are the ????? weight and ????? head circumference measurements in the data frame????????????????????? is the mean weight measurements and ?????????????? is the mean of the head circumference measurements c. Create a matrix containing NA values called rmat using the following command: <- matrix(NA, nrow = 4, ncol = 4). Use for loops to loop through the columns of the babyanth.complete data frame and calculate the Pearson's correlation coefficient between all possible pairs of variables in the dataset, i.e., all 16 pairs of variables (see below), and store all 16 Pearson's correlation coefficients in the matrix rmat. Copy and paste the output stored in rmat into a comment.All possible pairs of variables in the babyanth data frameWeight and Weight, Weight and Head, Weight and Arm, and Weight and Length,Head and Weight, Head and Head, Head and Arm, and Head and Length,Arm and Weight, Arm and Head, Arm and Arm, and Arm and Length,Length and Weight, Length and Head, Length and Arm, and Length and Length }};Explain a possible implmentation of such nested classes based on your answersabove; also give and justify a restriction on methods like updtx that eases thecost of implmentation. [5 marks]3 (TURN OVER)CST.2009.5.43 Computer Design(a) Why are control-flow machines sensitive to memory access latency? [4 marks](b) What statistical properties of data access patterns do caches exploit to reducememory access latency? [4 marks](c) What cache line replacement policies might be used for set-associative anddirect-mapped caches? [4 marks](d) What are two write-back policies for a cache? [4 marks](e) What does a snoopy cache do in a dual-core machine? [4 marks]4 Computer Design(a) For a MIPS-32 processor executing a jump to subroutine, how are state andcontrol passed between the function and the caller? Indicate what state ispassed, but details of particular register numbers are not required. [5 marks](b) On the MIPS-32 processor the flow of control can be changed using branch orjump instructions, or by three other mechanisms. What are the three othermechanisms for changing the flow of control and what are they used for?[6 marks](c) What is a control hazard and what hardware and software techniques can beused to resolve control hazards? [5 marks](d) Some instruction sets make all instructions conditional (e.g. the ARM) orhave conditional move instructions (e.g. IA32). How can these conditionalinstructions be used to avoid control hazards? [4 marks]4CST.2009.5.5  5 Concurrent Systems and Applications(a) Reflection.(i) Give Java code fragments demonstrating two different ways of obtaininga Class object that describes an array of java.lang.Strings. [2 marks](ii) Given an object x, write a Java expression that uses reflection to createa new object same datatype as x. [2 marks](iii) The clone() method creates an exct copy object, including all ofits fields. Briefly describe how you might implment this functionalityusing reflection, ignoring inherited fields. Assume that the object is notan array, has a zero-argument constructor, and contains only primitivefields. (You need not give code for an actual complete implmentation.)[4 marks](b) Generics.(i) Suppose a class B is a subclass of A. Is the class Set a subclass ofSet? Explain why or why not, with regard to type safety. [2 marks](ii) The default clone method returns an Object that must be cast to thecorrect type. Using generics, give a declaration of a static myclone methodthat takes a single argument of type and returns an object  sametype. [2 marks](iii) The Contraste interface is used to compare objects. Its declarationis:interface Contraste {boolean greaterThan(T obj1, T obj2);}Suppose we want to declare a class SortedList whose constructortakes a single Contrster argument that will be used to compare itselements. Give a declaration for the constructor that permits the choiceof contrastr impleentation to be as general as possible, and explainyour reasoning. [4 marks](c) Reference objects.The get() method oPhantomReference class always returns null. Whyis this so, and why must a PhantomReference always be used together with aReferenceQueue? [4 marks]Image transcription textQ1. Suppose that you are going to implement the queuestructure using circular linked lists. For the implementation,either the front or rear pointer (but not both) … Show more… Show moreImage transcription textCSIT 212 -Data Structures and Algorithm Analysis page 3. Giventhe following iterative code segment (5 points) // Print list using aloop void ListClass: :printIter (Node (P) p = head; whi… Show more… Show more  Computer Science Engineering & Technology Information Security CS MISC Share QuestionEmailCopy link