Docsity

Advanced Data Structures and Algorithms, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
Advanced Data Structures
and Algorithms - Test 1
Review
1 + (1 / 2) + (1 / 3) + ... + (1 / n) + ... + (1 / ((n^2) - 1)) + (1 / n^2) - ANS~
2ln(n)
1 + 2 + 3 + ... + 50 = - ANS1275 (the sum of numbers forumula: S(n) = (n(n
+ 1)) / 2 where n = 50)
1^100 + 2^100 + 3^100 + ... + n^100 ~ - ANS(n^101) / 101
A binary tree having n nodes is balanced means - ANSits depth is O(log(n)).
A node in a complete binary tree implemented using an array has index 100.
The indices of the parent, left child, and right child are respectively: - ANS49,
201, and 202 (floor((I - 2) / 2), 2I + 1, 2I + 2).
A priority queue is effectively implemented using a - ANSheap
A rule that is helpful when computing the limit of (f(n) / g(n)) as n
approaches infinity is: - ANSL'Hopital's Rule
An algorithm has polynomial time means - ANSW(n) ∈ O(n^k) for some
constant k.
An efficient algorithm for polynomial evaluation: - ANSHorner's Rule
pf3
pf4
pf5

Partial preview of the text

Download Advanced Data Structures and Algorithms and more Exams Data Structures and Algorithms in PDF only on Docsity!

Advanced Data Structures

and Algorithms - Test 1

Review

1 + (1 / 2) + (1 / 3) + ... + (1 / n) + ... + (1 / ((n^2) - 1)) + (1 / n^2) - ANS~ 2ln(n) 1 + 2 + 3 + ... + 50 = - ANS1275 (the sum of numbers forumula: S(n) = (n(n

  • 1)) / 2 where n = 50) 1^100 + 2^100 + 3^100 + ... + n^100 ~ - ANS(n^101) / 101 A binary tree having n nodes is balanced means - ANSits depth is O(log(n)). A node in a complete binary tree implemented using an array has index 100. The indices of the parent, left child, and right child are respectively: - ANS49, 201, and 202 (floor((I - 2) / 2), 2I + 1, 2I + 2). A priority queue is effectively implemented using a - ANSheap A rule that is helpful when computing the limit of (f(n) / g(n)) as n approaches infinity is: - ANSL'Hopital's Rule An algorithm has polynomial time means - ANSW(n) ∈ O(n^k) for some constant k. An efficient algorithm for polynomial evaluation: - ANSHorner's Rule

Data structure that can be used to implement recursion and convert any recursive algorithm, i.e., involving recursive calls to itself, to a non-recursive implementation of the algorithm: - ANSStack Deleting a node from a binary search tree that has two children involves swapping content with its - ANSinorder successor (or predecessor) and deleting the inorder successor (or predecessor). For a = 680 and b = 43 after one iteration of Euclid's GCD algorithm for computing the gcd(a, b) the values of a and b are - ANSa = 43, b = 35 HeapSort has complexity: - ANSO(nlog(n)) Insertion and deletion into a max-heap takes respective times: - ANSO(log(n)) and O(log(n)) Let a = Fib(n) and b = Fib(n - 1), where Fib(n) is the n-th Fibonacci number, n >= 2. After one iteration of Euclid's GCD algorithm the values of a and b are respectively: - ANSFib(n - 1) and Fib(n - 2) log(n!) has order - ANSnlog(n) Major design strategies that apply recursion: - ANSDivide-&-Conquer, Dynamic Programming, Backtracking n + 2n^3 + 3n^3 + ... + 100n^100 ~ - ANS100n^ Suppose that the limit of (f(n) / g(n)) as n approaches infinity equals 0. Then,

  • ANSf(n) has a smaller order.

The most multiplications performed by the left-to-right binary method for powers in terms of the number n of digits is about: - ANS2n The number of leaf nodes of a 2-tree with 101 nodes is - ANS The number of octal digits of an integer n is approximately equal to: - ANSlog8(n) The problem of computing n from b, p and b^n mod p is known as the - ANSDiscrete Logarithm Problem The recurrence relation for the worst-case complexity of MergeSort, assuming n is a power of 2, is given by: - ANSW(n) = 2W(n / 2) + n - 1, W(1) = 0 The sequence of computations in the action of the left-to-right binary method for the power 33 are: - ANSx -> x^2 -> x^4 -> x^8 -> x^16 -> x^ The smallest worst-case complexity for finding both the maximum and minimum elements in a list of even size n: - ANS3n/2 - 2 The worst-case complexity of an algorithm is - ANSthe most basic operations the algorithm performs for an input of size n. The worst-case complexity of Euclid's algorithm for computing the gcd(a, b) occurs when a and b are - ANSconsecutive Fibonacci numbers. The worst-case complexity of InsertionSort is: - ANS~ ((n^2) / 2) The worst-case complexity of QuickSort has order: - ANSn^

The worst-case complexity W(n) of LinearSearch for a list of size n is: - ANSn What are some major algorithm design strategies? - ANSDivide-&-Conquer, the Greedy Method, Dynamic Programming, Branch-&-Bound What is the symbol for strongly asymptotic? - ANSTilde (~) What sorting algorithms are in-place? - ANSBubbleSort, SelectionSort, InsertionSort, QuickSort, and HeapSort. Which asymptotic notation is used to give an order lower bound? - ANSUppercase omega (Ω) Which asymptotic notation is used to give the order? - ANSTheta (Θ) Which best describes an algorithm? - ANSSequence of steps for solving a problem. Which function has order strictly greater than nlog2(n)? - ANSNone has strictly greater order. Which traversal allows the records of a binary search tree to be stored in a sequential file, so that it can be recovered by reading records sequentially from the file and inserting them into a binary search tree, starting with the null tree? - ANSPreorder traversal Which traversal can be used to assign keys to a binary search tree, so that it becomes a binary search tree? - ANSInorder traversal