Algorithms Final
The code segment below finds the greatest number from a, an array of 500 integers. Its time complexity is O(n). greatest = a[0] for i from 1 to 499: if greatest < a[i]: greatest = a[i]
False
The graph below is a bipartite graph. Quiz 4 Question 8 & Image
False
The integer pair (77, 5) can be a public key in RSA.
False
The multiplicative inverse of 7 in Z subscript 11 is 5.
False
The recursive implementation of finding the n-th Fibonacci number is mathematically correct. Therefore, we can apply it in practice even when n is big.
False
The shortest pass tree from a given vertex of a connected weighted graph G(V, E) is always exactly the same as the BFS tree starting from the same vertex (do not make any assumptions.)
False
The shortest path tree obtained with Dijkstra's algorithm is also a minimum spanning tree of the same graph.
False
The time complexity of a double loop is O(n^2) always.
False
The topological order of a DAG is unique.
False
There are definitely no polynomial algorithms to solve any NP-hard problem.
False
There is not a built-in datatype available for relations in Python.
False
Two people apply Huffman code to compress the same text. Their Huffman codes for the same character must be exactly the same.
False
Using adjacency list representation for a graph G(V, E), one can find if there is an edge incident between two vertices in .
False
With Bellman-Ford algorithm, one may find a shortest path tree for a weighted digraph G(V, E) with negative valued edges even with a negative valued cycle.
False
With a binary tree to illustrate merge sorting an n-item array, the height of the tree is O(n).
False
With greedy approach, we can always find the best solution.
False
n^(1/5) = O(logn)
False
Perform DFS search starting from v1 for the graph graph2.png, excluding the starting node, the fourth node discovered is v4. (whenever there is a choice of vertices always pick the one in lexicographic order.) Quiz 3 Question 10 Image
True
A graph G(V, E) is strongly connected if and only if for any two vertices there is a path from to .
True
A graph G(V, E), directed or not, is a binary relation on V; and can be implemented as a dictionary in Python.
True
A greedy approach always makes the choice that looks best at the moment
True
A non-deterministic decision problem contains a guess step and a verification step.
True
A problem is NP-hard if it at least NP-complete.
True
A recursive algorithm can be coputationally efficient.
True
Algorithms developed with divide-and-conquer paradigm are often implemented recursively.
True
Algorithms developed with dynamic programming paradigm can often be illustrated as a dag in its topological order.
True
Alice and Bob may establish a secure communication even they have never known each other before.
True
All digraphs can be linearized as a DAG in terms of its strongly connected components.
True
An algorithm developed with the divide-and-conquer paradigm can be usually illustrated as a branch tree.
True
An encrypt function should be a bijection.
True
Any computational problem can be expressed as a True/False decision problem.
True
Applying DFS and BFS from the same starting node of a graph G(V, E), one may always get exactly the same connected component of G (Do not make any assumptions.)
True
Binary searching an element in a sorted n-element array is O(log n).
True
Both 3SAT and set cover problems are NP-complete.
True
Both Dijkstra shortest path algorithm and Prim's MST algorithm apply greedy approach.
True
Proposition:, then has a multiplicative inverse. Question 7, quiz 1
True
Both paradigms of divide-and-conquer and dynamic programming need to solve sub-problems to obtain a solution.
True
Breaking RSA is simple in theory but hard in practice when n is large.
True
Fast Fourior transformation algorithm is develoed with divide-and-conqure.
True
For a connected undirected graph G, both DFS and BFS algorithms can find a spanning tree.
True
If (33, 3) is a public key in RSA, then the private key is 7.
True
If for k different , then the probability of being prime is . Note: ignore Carmichael numbers. Quiz 1 Question 19
True
If is prime, then . Quiz 1 Question 17
True
If one NP-complete problem is tractable, then all NP-complete problems are tractable.
True
In Huffman coding tree, all characters must be in leaf nodes.
True
In analyzing asymptotic time complexity of a recursively defined algorithm, one may apply the master's theorem if the concur step is .
True
In analyzing the asymptotic complexity of f(n) in Big-Oh, we only need to consier the highest term of f(n).
True
In analyzing the asymptotic complexity of f(n), we should replace all constant factors with 1.
True
In divide-and-conquer approach, the divide step is top-down and the conquer step is a bottom-up.
True
In the worst case, quick sort can be quadratic.
True
Let G be a connected undirected graph. Then, one may find a path between any two vertices of G with DFS.
True
Let G be a directed graph. If there is a cycle on G, then one may find it with DFS.
True
Let G be a graph with n nodes and m edges. If there is a constant c > 0 such that m < cn, then the asymptotic time complexity for DFS is O(n).
True
Let G be a graph with n nodes and m edges. Then, the asymptotic time complexity for DFS is O(n +m).
True
Let G be an undirected graph. Applying DFS, one may always find its number of connected components.
True
Let be a graph with nodes and edges. If there is a constant such that , then, the asymptotic time complexity for both DFS and BFS is . Quiz 4 Question 5
True
Let m and n be two positive integers. Then, the most efficient algorithm available to find gcd(m, n) is O(log (max (m, n)).
True
Linearly searching an element in an n-element array is O(n).
True
Locating the value of the 100th element in an n-element array (n is at least 100) is O(1).
True
One may apply both greedy and dynamic programming to tackle NP-hard problems for approximated solutions.
True
Perform BFS search starting from v3, i.e. , for the graph graph2.png, then Quiz 4 Question 7 & Image
True
Provided a sequence: A = (5, 2, 8, 6, 3, 6, 7, 9). The longest decreasing subsequence ended at 3 depends on the lengths of decreasing subsequences ended at 5, 8, and 6, respectively.
True
Python 3 is very broadly used in the real world.
True
Python uses indentation spaces to specify code blocks.
True
Rewrite a mathematical expression from its simplest form to a more complicated one may lead to improvement of computational efficiency.
True
Set is a built-in datatype in Python.
True
Sorting an n-item array with merge sort. The merge step is O(n).
True
Sub-problems in divide-and-conquer have no overlap. But, there are overlapped sub-problems in DP.
True
The asymptotic time complexities of both DFS and BFS for G(V, E) are exactly the same as O(|V| +|E|).
True
The eighth Fibonacci number is 13.
True
The graph below on the left is a DAG. The graph on the right linearizes the DAG in its topological order. To find shortest paths from S in the graph with dynamic programming, it is better to use the graph on the right. Quiz 6 Question 8 Images
True
The is no integer solution for the equation 412x + 260y = 5.
True
The multiplicative inverse of Quiz 1 Question 16
True
The security of RSA relies on the fact: it is computationally hard to factor a large integer.
True
The time complexity of Kruskal's MST algorithm is O(|E| log |E|).
True
There is a linear algorithm to find the n-th Fibonacci number.
True
To prove a problem is NP-hard, one only need to show it is at least NP-complete.
True
Using adjacency matrix representation for a graph G(V, E), one can find if there is an edge incident between two vertices in .
True
We use Python 3 in this course this semester.
True
With Dijkstra's algorithm, one may find a shortest path tree for a weighted graph without negative valued edges.
True
With dynamic programming, one may solve some initially looks like intractable problems in simple code.
True
Python is hard to learn.
False
A main reason for using adjacency list rather than matrix to represent a graph G(V, E) is for time efficiency.
False
A pseudo prime number is prime mathematically.
False
Algorithms developed with dynamic programming paradigm can be illustrated as branch trees.
False
Alice must have both public and private keys for her to send a message to Bob.
False
All computational problems are decidable if provide unlimited computational resources.
False
All decidable problems are tractable.
False
Applying DFS and BFS from the same starting and ending nodes of a graph G(V, E), we always get the same path exactly.
False
Applying DFS from any starting node of a graph G, one may always get the same connected component of G (Do not make any assumptions on G.)
False
Applying divide-and-conqure, one may always improve computational efficienvy.
False
Both BFS and DFS can find a shortest path between two vertices in a connected graph G(V, E).
False
Both bubble sort and merge sort algorithms are quadratic, i.e., .
False
Both paradigms of divide-and-conquer and dynamic programming solve a problem top-down.
False
Dijktra's algorithm and Bellman-Form algorithm have exactly the same asymptotic time complexity.
False
Dynamic programming is a top-down paradigm in algorithm development.
False
Elements in a Python list must be in the same type.
False
Even in the best case, bubble sort is still less efficient than quick sort.
False
Given the same starting and ending nodes on a graph G, one always get the same path with DFS.
False
Huffman coding applies the divide-and-conquer paradigm because Huffman tree is a binary tree.
False
If (33, 3) is a public key in RSA, then it encrypts 5 as 23.
False
If and , then is prime. Quiz 1 Question 18
False
If f = O(g), then g = O(f) cannot be true.
False
In NP-completeness, the "NP" means non-polynomial.
False
It is very expensive computationally to evaluate a^n mod m when a, m, and n are very large integers.
False
Let G(V, E) be a connected weighted graph with more than |V| -1 edges. If there is a unique heaviest edge in G, then this edge cannot be a part of a minimum spanning tree (do not make any other assumptions.)
False
Let and be two strings. Then, the edit distance between and is Quiz 6 Question 10
False
Let e be any edge of minimum weight in G . Then e must be a part of every MST. (No any other assumptions should be made.)
False
Merge sort always perform better than bubble sort.
False
Nothing needs to be agreed in a symmetric cryptosystem.
False
One may use a matrix or adjacent list to represent an undirected graph but not for a digraph.
False
One should not try to solve any NP-hard problems because they are rarely appear in real world applications.
False
Proposition:, then has a multiplicative inverse. Question 8, quiz 1
False
Python is a compiled language like C++.
False
A directed acyclic graph (DAG) can be linearized according to its topological order.
True
A graph G(V, E) is not strongly connected if there are two vertices such that no path from to . Quiz 3 Question 16
True