1. Engineering
  2. Computer Science
  3. 1 5 marks show the following hold using the definition...

Question: 1 5 marks show the following hold using the definition...

Question details

1. [5 marks Show the following hold using the definition of Big Oh: a) 2 mark 1729 is O(1) b) 3 marks 2n2-4n -3 is O(n2) 2. [3 marks] Using the definition of Big-Oh, prove that 2n2(n 1) is not O(n2) 3. 6 marks Let f(n),g(n), h(n) be complexity functions. Using the definition of Big-Oh, prove the following two claims a) 3 marks Let k be a positive real constant and f(n) is O(g(n)), then k f(n) is O(g(n)) b) 3 marks] If f(n) is O(g(n) and g(n) is O(h(n)), then f(n) is O(h(n)). 4. 11 marks Consider the element distinctness problem: Given an array A storing n inte- gers, determine whether all the elements in the array are distinct or not. That is, if all the elements in A are unique, return true; return false if there is at least one duplicate element in A. Below four different problem instances are provided; elements bolded are duplicate elements 0 1 2 3 4 5 6 12312 3 4 false 0 1 2 3 4 5 41 22 6 8 false 0 1 2 3 true 0 1 2 3 45 6 7 true Design an algorithm that solves the element distinctness problem. a) [4 marks Write pseudocode for the algorithm b) Prove your algorithm is correct, do this by proving the two following parts: i marks] Show that the algorithm terminates in finite time ii) 2 marks Show that the algorithm always produces correct output e) 1 mark Explain what the worst case for the algorithm is. d) 3 marks Perform worst-case analysis to compute the time complexity of the algorithm. You must give the order of your complexity function using Big-Oh notation, and you must explain how you computed the time complexity

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution