cse 100
: A Count-Min Sketch provides a lower-bound on the true count of a given element x.
False
: Prim's Algorithm does not support graphs that contain cycles.
False
A large load factor will result in more wasted space, while a small load factor will result in more collisions on average.
False
Currently, no NP-Hard problems can be verified in polynomial time.
False
In the double hashing collision resolution strategy, we are guaranteed that two unequal objects x and y will be assigned different "skip" values.
False
The number of dictionary links in an Aho-Corasick Automaton always equals the number of nodes
False
You're asked to recommend potential data structures to use as the backing for implementing Kruskal's algorithm. Which of the following data structures would be most efficient with respect to runtime? If there are multiple best options, select all of them. Note: we are asking about runtime, not time complexity.
Heap
What is the average-case time complexity for insert in a hash table? O(1) O(log n) O(n) O(n log n) O(n²) None of the above
O(1)
Consider a Hash Table in which collisions are resolved using Separate Chaining. What is the tightest worst-case time complexity for an insert function that uses a Doubly-Linked List (i.e., there are head and tail pointers, and you can traverse the list in either direction) and inserts keys to the end of the Linked Lists? This insert function does not allow duplicates.
O(n)
In practice, Up-Tree implementations typically utilize path compression with Union by-Size. Why do they typically use Union-by-Size instead of Union-by-Height?
Path Compression makes it difficult to keep track of the heights of sentinel nodes
In Project 1, imagine your compress program successfully creates the output file, but when your compress program finishes running, the output file is empty. What might be the cause of this bug? Select all that apply.
The FancyOutputStream (and thus ofstream ) object opened the output file for writing, but none of the "write" commands were ever executed The FancyOutputStream (and thus ofstream ) object opened the output file for writing and executed some "write" commands, but the FancyOutputStream (and thus ofstream ) was never flushe
You and your friend are trying to design a good hash function for integer keys. Your friend suggests: H(k) = k % 20 Which of the following properties of keys will definitely lead to a distribution of hash values where some potential hash values from 0-19 might never be used?
The keys are all even Te keys are all odd
You're inserting n distinct strings, all of the same length k into an Aho-Corasick Automaton. Given only this information, which of the following can you deduce about the resulting automaton?
The number of dictionary links in automaton The number of leafe nodes in automaton The height of automaton
A Ternary Search Tree containing a set of n unique words will always have fewer nodes than a Multiway Trie containing the same set of words.
True
Finding a polynomial-time algorithm that solves the Hamiltonian Path Problem would prove that P = NP.
True
Given the same input graph, it is possible for Prim's Algorithm and Kruskal's Algorithm to output diferent Minimum Spanning Trees.
True
It is possible for every single node in a Multiway Trie to be a word node.
True
It is possible for every single node in a Ternary Search Tree to be a word node.
True
Problem 10.1: True/False: All problems in P are also in NP, regardless of whether or not P = NP.
True
The number of failure links in an Aho-Corasick Automaton always equals the number of nodes.
True
When representing a dense graph, the tightest worst-case time complexity of counting the number of outgoing edges for any arbitrary node will be faster if the graph is represented by an adjacency list than if the graph is represented by an adjacency matrix.
True
Which of the following data structures can be used to implement the Set ADT? Array List Linked List Binary Search Tree Randomized Search Tree AVL Tree Red-Black Tree None of the above
all of them
: True/False: In practice, we expect the insertion operation of a Red-Black Tree to be True False slower than that of an AVL Tree containing the same elements.
false
A pre-order traversal of a Binary Search Tree is guaranteed to visit the nodes of the tree in the reverse order of a post-order traversal.
false
To minimize the file size of the encoded message, we prefer that characters with lower frequencies have shorter symbol encodings than characters with higher frequencies.
false
: Which Up-Tree optimization provides the best speed-up in practice?
path comparison
Which of the following statements about collision resolution strategies are true? In Separate Chaining, we must use a Linked List as our "chain" data structure Separate Chaining avoids the "clump" problem that Linear Probing faces Separate Chaining will result in slightly less need for resizing the backing array than would Linear Probing With an optimally-designed Hash Table and collision resolution strategy, we can guarantee O(1) find and insert operations in the worst case None of the above
separate chaining avoid the "clump"problem that linear faces Separate chaining will result in slightly less need for resizing the backing array than would linear probing.