Sunteți pe pagina 1din 2

Mathematics 2320 Discrete Mathematics MidtermExamination

October 21 2013
Instructions: Do all problems. Present your solutions in the accompanying booklet in the order that they appear on this paper. No notes, crib sheets or books are allowed. A calculator is allowed. Questions are of equal weight. The test is 2 hours long. 1. Given two function f and g from the set of integers or the set of real numbers to the set of real numbers (a) define precisely what it means for f (x) to be (g (x) (b) define precisely why it means for f (x) not to be O(g (x) in such a way that no negation symbol comes before a logical connective for instance : (x, P (x) Q(x)) x : P (x) Q(x) 2. Show that x log x is O(x2 ) but that x2 is not O(log x). (3.2 no. 12) 3. Show that 4x2 log x + 6x log2 x is (x3 ). (like example 12 p. 215) 4. Describe an algorithm using pseudocode, as in the text or as in lecture notes, that locates the first occurrence of the largest element in a finite list of integers, where the integers in the list are not necessarily distinct (3.1 no. 17) 5. Using the number of comparisons as a measure of complexity, deduce the time complexity of the algorithm in the previous problem 6. Describe the bubble sort algorithm. What is the order of its time complexity? (see online notes) 7. What is the recursive definition that defines the Fibonacci sequence. What is the 10th Fibonacci number? (see page 347)

8. Give a recursive algorithm for finding the sum the first n even positive numbers. ( like 5.4 no. 9)

S-ar putea să vă placă și