MONO Answer all the questions. All sorting methods for an array of…
Question Answered step-by-step MONO Answer all the questions. All sorting methods for an array of… MONO Answer all the questions. All sorting methods for an array of n elements take time O(n 5 ). (c) It is possible to sort an array of n elements using binary comparisons in ?(n log n) time. (d) It is possible to sort an array of n elements using binary comparisons using O(1) (i.e. constant independent of n) additional space. (e) Radix sorting can sort any set of integers in linear time. (f ) All straight lines from the inside of a polygon to the outside intersect the points on the edges forming its boundary an odd number of times. (g) It is always cheaper to fino every other node. (h) It is possible to find the shortest paths between all N2 pairs of nodes of G in O(N3 ) time. (i) If G is connected then the minimal spanning subtree of G contains the N ? 1 edges whose weights are smallest. (j) Given n points (xi , yi), 1 6 i 6 n in a plane, then the four points (xa, ya), (xb, yb), (xc, yc), (xd, yd) such that xa is minimal of the xi , xb is maximal of the xi , yc is minimal of the yi , yd is maximal of the yi form a quadrilateral Q which can be used to speed up a convex hull algorithm by preprocessing to remove points which lie inside Q. Marks will be awarded for overall succinctness, attention to detail and absence of random guesses lacking justification.Find expressions for (a) the absolute error in representing x1 + x2 (b) the relative error in representing x1.x2 (where “.” denotes multiplication) Assume that the numbers 1 and 2 are represented exactly. Find an expression for the absolute error in calculating 2x + 1. [2 marks] In an iterative calculation the number y is an improved value of x, derived from the assignments p := x/2 + 1 q := x ? 2 y := p + 1/q If ?x is the absolute error in representing x, find an expression for the absolute error ?y in representing y. What is the approximate relative error ?y in representing y when x = 2.01? Graphics Describe a quad-tree encoding method for greyscale images. [6 marks] Given the following greyscale image, draw a diagram showing how it would be encoded using your method from the previous part. 33 39 43 72 34 54 64 81 42 54 71 83 60 64 77 89 An image processing package allows the user to design 3 × 3 convolution filters. Design 3 × 3 filters to perform the following tasks: (a) blurring (b) edge detection of vertical edges [2 marks] Choose one of the two filters (a) or (b) from the previous part. Explain how it works, using the following image as an example (you may round off any calculated values to the nearest integer). 100 100 100 0 0 0 100 100 100 0 0 0 100 100 100 0 0 0 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 [6 marks] 12 Digital Electronics Design a synchronous sequential circuit with one input and one output which produces an output X = 1 whenever any of the following input sequences occur: 1100, 1010 or 1001. The circuit resets to its initial state after a 1 output has been generated. (a) Draw a state diagram and provide a transition table. (b) Choose an assignment and show the control factors for JK flip flops. Software DesignSoftware systems often incorporate structural representations of the applicationdomain in which they operate. For example, a vehicle control system should beaware of the fact that the car has precisely four wheels. This kind of informationmust be captured, encoded and tested at each stage of the software design process.Using the number of wheels in a car as a simple example, describe relevant designactivities and products at each of the following phases of a software project:(a) inception; [4 marks](b) elaboration; [4 marks](c) construction; [4 marks](d) transition; [4 marks](e) system operation. [4 marks]8 Regular Languages and Finite Automata(a) Explain what is a context-free grammar and the language it generates.[4 marks](b) What does it mean for a context-free grammar to be regular? Given anydeterministic fifinite automaton M, describe a regular context-free grammarthat generates the language of strings accepted by M. [4 marks](c) Construct a non-deterministic fifinite automaton with ?-transitions whoselanguage of accepted strings is equal to the language over the alphabet {a, b, c}generated by the context-free grammar with non-terminals q0 and q1, whosestart symbol is q0 and whose productions are q0 ? abq1, q1 ? ?, q1 ? q0 andq1 ? abc. [4 marks](d) Is every language generated by a context-free grammar equal to theset of strings accepted by some non-deterministic fifinite automaton with?-transitions? Justify your answer. (Any standard results about regularlanguages you use should be carefully stated, but need not be proved.)[8 marks]7 (TURN OVER)CST.2008.2.89 Professional Practice and Ethics(a) The British Computer Society Code of Conduct has four sections. What kindof professional conduct does each section cover, and how does each of thesekinds of conduct benefifit the profession and its members? [8 marks](b) True or False questions:(i) A User can provide occasional use of the University computer system fora friend who is a temporary visitor.(ii) Circumstances that mitigate minor infractions of the rules promulgatedby the Information Technology Syndicate include, among other things,inebriation.(iii) Appropriate use of the Cambridge University Data Network (CUDN)means bona fifide academic activity plus a low level for private purposes.(iv) Small amounts of commercial activity are acceptable as long as the Useris acting in a private capacity.[4 marks](c) The IT industry is increasingly aware of its own environmental impact.Describe at least one environmental problem to which the industry contributesand how, as an IT professional, you can help to solve this problem. [4 marks](d) “Social engineering is a greater threat to computer security than computercracking software.” What is social engineering and what measures can betaken to guard against it? [2 marks](e) What is copyleft and how is it used to protect free, open-source, software?(a) Brieflfly explain the difffferences between combinational and sequential logic.[2 marks](b) With the aid of appropriate diagrams, brieflfly explain the operation of Mooreand Mealy fifinite state machines and highlight their difffferences. [6 marks](c) The state sequence for a binary counter is as follows: The counter is to be implemented using four synchronously clocked D-typeflflip-flflops.(i) Draw a state table for the counter, showing the required D inputs.[4 marks](ii) Find expressions for the D inputs, making use of unused states ifappropriate. [6 marks](iii) What problem could occur when the counter circuit is powered-up? Givetwo possible general methods for overcoming the problem. [2 marks]2CST.2008.2.32 Digital Electronics(a) With the aid of relevant diagrams, show the effffect on the output of acombinational logic circuit of a:(i) static hazard;(ii) dynamic hazard. [3 marks](b) Simplify the following expressions using Boolean algebra:(i) X = (A + B + A . B).(A + B). A . BContrast the two approaches with regard to their support for dynamic memory allocation, efficiency of memory use, support for code/data sharing, and data protection. [10 marks] 2 CST.98.1.3 SECTION B 5 Foundations of Computer Science Discuss how lazy lists and mutable lists can be coded in ML. How do they compare with ML’s built-in lists? Illustrate your answer by considering the operations of reversing a list and of concatenating two lists. Your discussion should mention the main programming hazards. [6 marks] The function odds is to return the list of alternate elements of its input. For example, odds[a, b, c, d, e] = [a, c, e] and odds[a, b] = [a]. Code odds using (a) ordinary ML lists [3 marks] (b) lazy lists [5 marks] (c) mutable lists (as an imperative operation so that odds has type ‘a mlist -> unit for a appropriate datatype ‘a mlist of mutable lists, to be described) [6 marks] 6 Foundations of Computer Science What does O(g(n)) mean, and what is its relevance to programming? (Describe each benefits and limitations.) [5 marks] Consider the subsequent Tip of ‘a; fun flatten (Tip x) = [x] length of an expression is the number of Tips it consists of. State the complexity of flatten(e), measured in cons operations, as a feature of the scale of e: (a) inside the worst case [3 marks] (b) inside the average case [4 marks] (c) in the first-rate case [3 marks] Code a characteristic flat such that flat(e) = flatten(e) for all e, justifying this declare. Show that flat’s worst-case complexity is linear. [5 marks] three [TURN OVER CST.98.1.Four SECTION C 7 Discrete Mathematics State and show the Chinese Remainder Theorem regarding the simultaneous answer of a pair of congruences to co-prime moduli and the individuality of that solution. [10 marks] An early shape of public key encryption worked as follows. A character, R, wishing to obtain secret messages, selected two large primes, p and q also co-high to p ? 1 and q ? 1, and published their product, n = p × q. Another character, S, wishing to ship a message m to R, encoded it as s = mn(mod n). Show how to calculate inverses a and b so that ap ? 1(mod q ? 1) and bq ? 1(mod p ? 1). By thinking about s a (mod q) and s b (mod p) and recalling the Fermat-Euler theorem, show how R could get better the unique message, m. State definitely another effects that you use. [10 marks] eight Discrete Mathematics What is a partial order on a set? What is a complete order? Given two completely ordered sets (A, 6A) and (B, 6B), define the Product Order and Lexicographic Order on A × B and display that they may be partial orders. Show that the Lexicographic Order is a total order and that it carries the Product Order. [10 marks] Let S be the set of functions from N to zero, 1. Define a relation F on S by using (f, g) ? F ?? ?n ? N. F(n) 6 g(n). Show that F is a partial order. Define a relation G on S by (f, g) ? G ?? X n?N f(n)10?n 6 X n?N g(n)10?n . Show that G is a total order and that it contains F. [10 marks] 4 CST.98.1.Five SECTION D nine Programming in Java A entire Java program can also use the identical call for several one-of-a-kind strategies or variables. Java has some of functions that permit the user to prevent such re-use of names from causing chaos. Describe those beneath the headings: (a) scope regulations inside person capabilities; [6 marks] (b) visibility of technique names inside lessons, and the results of inheritance; [8 marks] (c) keeping off ambiguity whilst relating to the names of instructions. [6. recursive capacity f : N ? N.’ [3 marks] In every one of the accompanying cases state with reasons whether the set is recursively enumerable: (a) the set An of all complete recursive capacities a : N ? N to such an extent that a(n + 1) > a(n) for all n ? N [7 marks] (b) the set D of all absolute recursive capacities d : N ? N to such an extent that d(n + 1) 6 d(n) for all n ? N [10 marks] 11 Complexity Theory Explain the connection among number and polynomial augmentation. [2 marks] Show how the last option can be decreased to an addition issue which can be addressed by grid duplication. [4 marks] Starting from this thought, frame a proficient calculation for shaping the result of two n-digit unsigned numbers. [12 marks] What is the expense of the calculation that you have depicted? [2 marks] 4 CST.93.6.5 12 Formal Languages and Automata For every one of the accompanying dialects over the letter set {a, b}, say whether it is normal. Legitimize your responses expressing obviously any outcomes that you use. (a) The arrangement of all strings which are not palindromes (for example which are not equivalent to their own opposite) [4 marks] (b) The association of countably numerous normal dialects L [4 marks] (c) The arrangement of all strings where the quantity of events of the letter an and the quantity of events of the letter b are both distinct by 3 [4 marks] (d) The arrangement of all strings which are of the structure ww for some string w [4 marks] (e) The arrangement of all strings with the end goal that in each underlying substring the quantity of events of the letter an and the quantity of events of the letter b vary by something like 2 [4 marks]What’s the significance here for a capacity to be an infusion, a surjection, and a bijection? [4 marks] (b) For sets An and B, characterize without evidence a bijection from P(A×B) to [A ? P(B)] and its reverse. [4 marks] (c) For sets A, B and C, characterize without confirmation a bijection from [(A × B) ? C] to [A ? (B ? C)] and its converse. [4 marks] (d) Let X be a set. Demonstrate there is no infusion f : P(X) ? X. [Hint: Consider the set W = {f(Z) | Z ? X ? f(Z) ?/Z}.]You might utilize standard outcomes given that you notice them obviously. (a) (I) State an adequate condition on a couple of positive numbers an and b so the accompanying holds: ? x, y ? Z. x ? y (mod a) ? x ? y (mod b) ?? x ? y (mod stomach muscle) [2 marks] (ii) Recall that, for a positive whole number m, we let Zm = {n ? N | 0 ? n < m} and that, for a number k, we compose [k]m for the one of a kind component of Zm with the end goal that k ? [k]m (mod m). Let an and b be positive numbers and let k and l be numbers with the end goal that k a+l b = 1. Think about the capacities f : Zab ? Za×Zb and g : Za×Zb ? Zab given by f(n) = [n]a , [n]b , g(x, y) = [k a (y ? x) + x]ab Prove either that g ? f = idZab or that f ? g = idZa×Zb . [8 marks] (b) Let T ? mean the reflexive-transitive conclusion of a connection T on a set A. For relations R and S on a set A, demonstrate that on the off chance that idA ? (R ? S) (R ? S) ? = (R ? S) ? . Note: You may on the other hand think about T ? to be characterized as either [ n?N T ?n , where T ?0 = idA and T ?(n+1) = T ? T ?n or as { R ? A × A | (T ? idA) ? R ? R ? R ? R } or as inductively given by the principles (x, y) (x, y) ? T (x, x) (x ? A) (x, y) (y, z) (x, z) (x, y, z ?Characterize a reasonable G0 or make sense of why G as of now fulfills the measure. [6 marks] Write a setting free (Type 2) language structure which depicts drifting point quantities of the structure [±]dd? [.d? ][e[±]dd? ] where d represents decimal digit and d ? represents at least zero decimal digits. [· · ·] implies that the encased thing is alternatively present in the drifting point number. [7 marks] Sketch a recursive plunge parser for the accompanying punctuation H with start image S. You ought to accept the presence of a routine lex() which sets variable token to one of '1', '2', '(', ')', '- ' or eof. P - > 1 | 2 | (E) E – > P | E – P S – > E eof [7 marks] 8 Prolog for Artificial Intelligence A three parted tree is developed from 3-ary compme that number parts are limited to the qualities 0 and 1. Compose a Prolog program to return a rundown of all the 0’s and a rundown of all the 1’s in a given tree. For instance, the objective enum(n(n(0, 1, 0), 1, 0), X, Y) ought to launch X to [0, 0, 0] and Y to [1, 1]. The program ought to utilize contrast records. [10 marks] A terminal hub of the three parted tree is supposed to be of odd equality assuming the quantity of its 1 parts is an odd number. For instance, n(1, 1, 1) is of odd equality, and n(1, 0, 1) isn’t of odd equality. Compose a Prolog program to count the quantity of terminal hubs in a tree that have odd equality. For instance, the objective odd(n(n(0, 1, 0), 1, 0), X) ought to start up X to 1.The upper bound of a set S ? An is a component u ? A (yet not really in S) suchthat ? s ? S . s 6 u. The most un-upper bound of S is an upper bound of S that is lessthan each and every upper bound of S. The best lower bound is characterized in much the same way.A cross section is a to some extent requested set in which each sets of components has both a leastupper bound and a biggest lower bound.(b) Prove that (N, |), the regular numbers under the distinguishableness request, structure agrid. [4 marks](c) Given a set X, demonstrate that (P(X), ?), the power set of X under set consideration,structures a grid. [4 marks](d) Does each subset of (N, |) have a most un-upper bound and a biggest lowerbound? Legitimize your response. What might be said about (N0, |) and (P(X), ?)? [4 marks](e) If (A, 6A) and (B, 6B) are cross sections, show that A×B is a grid under theitem request.In each part you are given the consequence of a SQL question along with a potentiallywrong end drawn from this outcome.For each situation your errand is to contend possibly in support of the end. You should plainlylegitimize your thinking. On the off chance that the SQL question can be remedied, do as such.(a) The accompanying question returns 1422.End: Our data set contains data on 1422 chiefs.select count(*)from has_positionwhere position = ‘chief’;[6 marks](b) The accompanying question returns these records:nm0498278 Stan Lee essayist 15End: Stan Lee didn’t deliver any of the motion pictures in our information base.select person_id, name, position, count(*) as aggregatefrom has_position as hpjoin individuals as p on p.person_id = hp.person_idwhere position <> ‘entertainer’what’s more, name = ‘Stan Lee’bunch by person_id, name, position[6 marks][proceeded . . . ]Compose Java program to peruse a record content line by line.1 b) Write java program to peruse a record line by line and store it into a variable.(c) The accompanying inquiry endeavors to return records (job, year, all out) whereJennifer Lawrence assumes a similar part during the year a complete number oftimes in various films. The inquiry returns these records:Job YEAR TOTAL—————- —- —–Tiffany 2012 1Persona 2011 1Raven 2011 1Aurora Lane 2016 1Katniss Everdeen 2012 2Ree 2010 1Rosalyn Rosenfeld 2013 1Katniss Everdeen 2013 2End: Jennifer Lawrence played Katniss Everdeen in two films in 2012.select r1.role, m1.year, count(*) as aggregatefrom plays_role as r1join plays_role as r2 on r2.person_id = r1.person_idjoin motion pictures as m1 on m1.movie_id = r1.movie_idjoin motion pictures as m2 on m2.movie_id = r2.movie_idjoin individuals as p on p.person_id = r1.person_idwhere p.name = ‘Jennifer Lawrence’furthermore, r1.role = r2.rolebunch by r1.role, m1.year;You are furnished with a 2D triangle network characterized by a bunch of vertices V [k] =(xk, yk, ak) for k = 1, . . . , N, and a triangle file table T of aspect M×3, whereM is the quantity of triangles. xk and yk are the directions of vertex k and ak is itsscalar trait. An illustration of such a triangle network is displayed underneath.(a) Write down the triangle record table of the lattice displayed in the figure above.Guarantee that all triangles are front aligned. [4 marks](b) Write pseudocode for a capacity a = query a(x, y, V, T), which returns theworth of the directly introduced trait at the point (x, y) when the pointlies on the cross section and ?1 in any case. Utilize square sections to record vertex (V [i])also, triangle (T[i, j]) tables. The pseudocode ought to incorporate the recipes requiredto figure the interjected quality worth and to check whether the fact of the matter isinside the triangles. [10 marks](c) Suppose that now vertices additionally incorporate a profundity, so V [k] = (xk, yk, zk, ak),furthermore, triangles cross-over and impede each other. How would you really want to changethe pseudocode to return the characteristic of the apparent triangle that has the most reducedz-esteem at a given point? Because of memory constraints,? Answers? Computer Science Engineering & Technology Networking GRAFICA 0125 Share QuestionEmailCopy link Comments (0)


