an operation that yields a N aN value when neither of its arguments is a N aN,
Question:
an operation that yields a N aN value when neither of its arguments is a N aN, (b) an operation with finite arguments that yields +, (c) an operation with an argument + that yields a finite result. [5 marks] What two rules govern operations where at least one argument is a N aN value? [2 marks] 4 CST.94.11.5 10 Discrete Mathematics Let (N, 6) be the natural numbers under the usual ordering. Assuming that (N, 6) is well-ordered, prove that the Cartesian product (N N) is well-ordered under the derived lexicographical ordering. [6 marks] State the Principle of Well-Ordered Induction
f its nodes of the form Br(v, t1, t2), the number of Br nodes in t1 differs from the number of Br? nodes in t2 by at most one. Express this definition succinctly as an ML function of type 'a tree->bool. [2 marks] Show how to implement functional arrays using binary trees, such that the root? holds the value of subscript 1, the left subtree holds the values of even subscripts, and the right subtree holds the values of odd subscripts. Explain? how the update operation works, taking subscript 6 as an example. [5 marks] Give an informal proof that every functional array must be represented by a balanced tree. You may assume that the array contains no gaps, i.e. the defined subscripts are 1, . . . , n for some n > 0. [7 marks] Let the depth of a tree be defined by depth(Lf) = 0 and depth(Br(v, t1, t2)) = 1 + max{depth(t1), depth(t2)}. State and justify precise lower and upper bounds for the number of Br nodes contained in a balanced tree of depth d, for arbitrary d > 0.
Computation Theory Explain what is meant by the following: 'F is a recursively enumerable set each of whose elements is a total recursive function f : N N.' [3 marks] In each of the following cases state with reasons whether the set is recursively enumerable: (a) the set A of all total? recursive functions a : N N such that a(n + 1) > a(n) for all n N [7 marks] (b) the set D of all total recursive functions d : N N such that d(n + 1) 6 d(n) for all n N
1 Complexity Theory Explain the relationship between integer and polynomial multiplication. [2 marks] Show how the latter can be reduced to an interpolation problem which can be solved by matrix multiplication. [4 marks] Starting from this idea, outline an efficient algorithm for forming the product of two n-bit unsigned integers. [12 marks] What is the cost of the algorithm that you have described?
Forward to signify statistics being forwarded from one cache to another. [6 marks] (iii) Draw a table showing how the nation of a line in a single cache limits the states? the identical line may have in a exclusive cache. [2 marks] (iv) Give two advantages of including this extra owned country to the basic MSI protocol.
(a) At the lowest level, what is the number one client of electrical energy in digital good judgment nowadays? Give a method for the anticipated electricity or power use for a CMOS? gate. [2 marks] (b) A matrix (a 2-dimensional array) is saved on-chip in static RAM. What most important? factors contribute to the time and energy had to transpose it? [4 marks] (c) Assume now a square matrix is to be held in DRAM. (i) When would possibly it's useful to shop multiple-copies of a given matrix in different DRAM banks? [1 mark] (ii) When would possibly it be helpful to shop a couple of-copies of the matrix (or any other example facts shape) in one DRAM bank? [2 marks] (iii) One way to avoid transposing a matrix is simply to hold an annotation that it's been transposed and to then change over the row and column arguments for every operation. Why would possibly physically acting the transpose in the long run advantage overall performance? Where would the annotation? be held? [2 marks] (d) A computation operates on square matrices of length 105 one zero five . The inner loop, to be increased in hardware, has the following basic structure: for (int i= ...) for (int j= ...)
DD[i, j] = ff(SS[i-1, j], SS[i, j-1])
(i) Are there any loop-carried dependencies? What does this imply for overall performance optimisation? [1 mark] (ii) If the DRAM timings are eleven-11-eleven, that means row activation, column activation and writeback each take eleven clock cycles, estimate kind of the minimal time for a naive implementation of the computation. Assume a simple linear data layout. State all similarly assumptions. [6 marks] (iii) What determines whether or not it's miles possible or an awesome concept to carry out the operation 'in area' (ie. The use of the same reminiscence for DD and SS)?
. Write program to examine facts the usage of CL check in and test whether or not it's superb or negative. A java program that takes both n (as input) and n integer inputs and upload the given values to a? described array. (a) Give typing regulations for the introduction form %(, M) and elimination shape unpack M as (x, ) in N of the existential kind ( ). [4 marks] (b) An countless move of booleans can be represented within the polymorphic lambda calculus using the existential kind stream , ( ( (bool ))) (i) Using the encoding above, outline a function head : circulation bool. [3 marks] (ii) Using the encoding above, outline a feature tail : circulate stream. [3 marks] (iii) Using the encoding above, define a feature? spread : ( ( (bool )) stream) [11:50 PM, 4/26/2022] .: Describe the state-variable representation for planning by way of discussing the following, giving specific examples of each concept: (i) Rigid members of the family and kingdom variables. [2 marks] (ii) Actions. [2 marks] (iii) The illustration of state. [2 marks] (iv) Goals and solutions. [2 marks] (b) Your boss has recommended the usage of heuristic seek to clear up a making plans trouble expressed in the country-variable representation. Explain how this is probably achieved. You do not need to signify a particular heuristic at this degree. [3 marks] (c) Comment on whether or no longer heuristic seek is a superb approach to solving making plans issues within the state-variable representation, as compared with the opportunity of the use of a constraint satisfaction solver. [5 marks] (d) Suggest an admissible heuristic that would be used when applying A? Seek to fixing a planning hassle inside the kingdom-variable representation. Show that it's miles admissible. [4 marks] three (TURN OVER) CST1.2019.6.Four 3 Complexity Theory A Boolean formula is said to be satisfiable if there is an challenge : V proper, false of values to the variables of that makes it authentic. A quantified Boolean method is an expression that is (i) both a Boolean formula; or (ii) X in which is a quantified Boolean method and X is variable; or (iii) X in which is a quantified Boolean system and X is variable. We say that a quantified Boolean formula is glad by using an assignment : V real, fake if either is a Boolean formula this is made proper via ; or is X and both [X/true] or [X/false] make authentic; or is X and each [X/true] and [X/false] make genuine. Here, [X/v] denotes the undertaking that is similar to for all variables apart from X, and it maps X to the reality price v.? We write QBF for the decision problem of figuring out whether or not a given quantified Boolean formulation is satisfiable. In answering the questions underneath, you could expect the NP-completeness of any general trouble, as long as you kingdom your assumptions definitely. (a) Show that QBF is NP-difficult. [4 marks] (b) Show that QBF is co-NP-difficult. [6 marks] (c) Show that QBF is in PSpace. [6 marks]
You have to discover p, an eight-individual password, every person having been selected uniformly at random from a regarded alphabet of sixty four ASCII characters. In the weeks preparing for the opposition, you have got access to a small cluster of GPU photographs playing cards that can evaluate MD5 109 times consistent with 2d. During the competition, you have got only get admission to to a computer pc that may examine MD5 106 instances in line with 2d. Without any pre-computation, how long would it take to evaluate MD5 for all possible passwords p in a brute-pressure assault (i) at the laptop? [2 marks] (ii) at the GPU cluster? [2 marks] You determine to use the GPU cluster to pre-compute a rainbow desk for this undertaking. (iii) What functions aside from MD5 will the GPU cluster ought to evaluate as regularly as MD5 when building the rainbow table? [3 marks] (iv) Your laptop has sufficient RAM for storing the rainbow table as a hash desk of 232 key-value pairs (x, y) with x, y 0, 1 128. If you execute MD5 250 instances even as generating your rainbow table, how lengthy will your computer need (worst case) to discover a password p stored in it, given its MD5 hash value MD5(p)? Assume that the runtime is completely dominated with the aid of the MD5 opinions?
(a) (i) Describe the difference between relevance remarks and question growth in phrases of person interplay. [2 marks] (ii) Explain what we mean by means of equivalence classing of phrases and why it is beneficial. Give one instance of equivalence classing that may fail to retrieve the right files. [2 marks] (iii) Give an example of how uneven growth of query terms can usefully version customers' expectations. Is uneven expansion of question phrases greater or much less green than equivalence classing? Justify your solution. [2 marks] (iv) How would you compare an Information Retrieval challenge for which there is high tolerance for left out applicable facts gadgets? How would possibly you modify the F degree for this kind of undertaking? Justify your answer. [3 marks] (b) (i) Given the query "elvis music" and the following term frequencies for the 3 files doc1, doc2 and doc3 : elvis presley mississippi pop tune life doc1 3 four zero 6 0 0 doc2 4 zero four zero zero 3 doc3 five 3 zero four four 0can be indexed only by ordinal types, which means that, for example, it is not possible to have an array indexed by TEXT strings. One way of overcoming this restriction is to use hash tables. Write a generic interface, Table, to manage tables of values of type Value.T indexed by values of type Key.T. A Table.T should be an opaque object with methods init to initialise the hash table to a particular size, and put and get to store and recover values, all having appropriate signatures. Use exceptions to indicate duplicate or missing keys. [6 marks] Sketch a generic implementation of the Table module giving a concrete revelation of T and providing appropriate default methods. It is not necessary to protect the data structure against concurrent access. [8 marks] What constraints do your interface and implementation impose on interfaces supplied for Key and Value when instantiating Table? [2 marks] Show how Table could be instantiated to provide an array of integers indexed by text strings, and indicate how this might be used to manage a (write-once) telephone directory. [4 marks] 1 Programming Language Compilation Carefully describe how to construct the precedence matrix for a given grammar, illustrating your answer by investigating whether the following is a precedence grammar. S -> a P Explain why replacing the productions S - introduce conflicts in the precedence matrix. [2 marks] Give a detailed description of a parsing algorithm that uses a precedence matrix. [8 marks] 3 Formal Languages and Automata Explain what is meant by a context-free language. [5 marks] Show that the union of two context-free languages (over the same alphabet ) is again context-free. [5 marks] Consider the language L over the alphabet {a, b, c} consisting of all strings of the form a ` b mc n, where `, m, n > 0 and either ` = m or m = n. Is L context-free? Is it a regular language? Justify your answers, stating carefully any well-known results that you use. [10 marks] 2 CST.94.4.3 4 Operating System Functions Describe the use of a table of pointers and a table of extents to store the list of disc blocks which compose a file. Pay particular attention to how such data structures can be designed to enable the efficient support of very large files, and give estimates of their performance for finding the location of a block chosen at random. [14 marks] Describe how such data structures would be used in the implementation of a log-structured file system with consideration of the impact of garbage collection. [6 marks] 5 UNIX Case Study For the UNIX operating system, define (a) process [2 marks] (b) the execution environment of a process [3 marks] (c) the fork system call [3 marks] Explain how a command line of the form given below is implemented: command & [9 marks] Outline the essential difference in the implementation of command lines of the form given below: command1 & command2 command1 | command2 [3 marks] 6 Data Structures and Algorithms Explain how it is possible to construct red/black search trees, using one extra bit per node, so that the trees remain reasonably balanced. [13 marks] How out of balance can your tree get and what are the worst case costs for adding a new item and finding an existing one? [7 marks] 3 [TURN OVER CST.94.4.4 7 Data Structures and Algorithms Suppose that you have been provided with a procedure that can, given n items, find the one that would come at position n/3 if the items were sorted into ascending order. Further suppose that when this procedure is called it always costs exactly 10n comparisons. Explain how this would allow you to implement a variant on Quicksort exhibiting guaranteed good computing time. [7 marks] Estimate very roughly (but justify your estimate) how much data would be needed before you could be certain that the worst case for a simple implementation of Quicksort would involve more comparisons than the worst case of your new algorithm. [10 marks] Would you ever expect anybody to want to use your new method in practical applications? [3 marks] 8 Graphics Describe the method of Douglas & Pucker for approximating one line chain by another to within some tolerance. Are there any special cases? [20 marks] 4 CST.94.4.5 9 Numerical Analysis I With reference to a decimal floating-point implementation with 4-digit precision ( = 10, p = 4), describe the two most common methods of rounding. (Use 1.2345 and 1.2375 as examples.) Which method is unbiased? [3 marks] What do you understand by the terms machine epsilon, and guard digit? [4 marks] Suppose the largest representable floating-point number is about 1050, and consider evaluation of p x 2 y 2. How would you compute the result? (Use x ' 5.1040 , y ' 3.1040 as an example.) How could your m
answer all
Explain how tunnelling is required by this scheme. [3 marks] 3 Bioinformatics (a) Discuss why the use of spaced seeds in sequence database search is better than the use of consecutive seeds. [5 marks] (b) Discuss the complexity of Sankoff's parsimony method. [5 marks] (c) Describe the four points conditions in phylogeny. [5 marks] (d) Discuss the assumptions of the Gillespie algorithms
(i) For what kind of surface is the reflectance map simply (i, e, g) = cos(i)? Name this type of surface and describe its key properties. [3 marks] (ii) For what kind of se co-planar with the surface normal N, and (i, e, g) = 0 otherwise? Name this type of surface and describe its key properties. [3 marks] (iii) For what kind of surface does the reflectance map depend only on the ratio of the cosines of the angles of incidence and emission, cos(i)/ cos(e), but not upon their relative angle g nor upon the surface normal N? Give an example of such an object, and explain the consequence of this special reflectance map for the object's appearance.
Write a program that reads a source file and writes out the names of files #included. Indent file names to show files #included by included files. Try this program on some real source files (to get an idea of the amount of information included). [4] ( 3) Modify the program from the previous exercise to print the number of comment lines, the number of non-comment lines, and the number of non-comment, whitespace-separated words for each file #included. [5] ( 2.5) An external include guard is a construct that tests outside the file it is guarding and includes only once per compilation. Define such a construct, devise a way of testing it, and discuss its advantages and disadvantages compared to the include guards described in 15.3.3. Is there any significant run-time advantage to external include guards on your sys- tem? [6] ( 3) How is dynamic linking achieved on your system? What restrictions are placed on dynamically linked code? What requirements are placed on code for it to be dynamically linked? [7] ( 3) Open and read 100 files containing 1500 characters each. Open and read one file con- taining 150,000 characters. Is there a performance difference? What is the highest number of files that can be simultaneously open on your system? Consider these questions in relation to the use of #include files. [8] ( 2) Modify the desk calculator so that it can be invoked from main() or from other functions as a simple function call. [9] ( 2) Draw the ''module dependency diagrams'' (15.3.2) for the version of the calculator that used error() instead of exceptions (14.2.2)C
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest