CSE 100
T or F: Using quick sort with a random pivot gives an O(N^2) expected time algorithm.
False
T or F; The balance condition of an AVL tree ensures that depth is Theta(N) where N is # of nodes in the tree
False
T or F; it is not possible for cycles to form when inserting into a hash table that implements cuckoo hashing.
False
Difference between centralized VCS and distributed VCS
In DVCS, every checkout contains the data while centralized VCS only have data on one server.
The space requirement for adjacency list is
O(|E| + |V|)
What property of the tablesize do we aim for in a hash table ?
it should be prime
Most similar tree traversal to BFS
level-order traversal
Most similar tree traversal to DFS
pre-order traversal
output for this code: map<string, double> gpa_map; cout << gpa_map["alex"] << endl;
program prints out zero
Which method would you use to read 1 or more bytes at a time from binary file in C++?
read
When will there most likely be no savings in space when using Huffman's algorithm?
the characters have same frequency
In C++, file streams use an internal buffer rather than write to the physical file on each write.
true
T or F: Each element in a set S appears in exactly different equivalent classes.
False
How do we get the value --1 or 0 -- of the nth bit from the left of a byte argument b?
(b >> (7-n)) &1
Problems can be effectively solved by suffix tree
1. Finding the longest repeated substring in a tree. 2. Finding the longest common substring in two strings 3. Finding the most common substring of a specified length.
Which of followings are true? 1. TSTs works for any kind of keys 2. TST support ordered access to string keys(i.e. you can enumerate the keys in sorted order) 3. TSTs are particularly fast then the data to be found is not in the TST. 4. In a TST, each node has between o - 3 children (inclusive)
2, 3, 4
In perfect hashing, if N items are placed into a primary hash table contains N bins, then what is the maximum expected value of the total size of secondary hash tables?
2N
How many bits for each ASCII symbol in 256 characters set required with a fixed length encoding scheme?
8
What property does a problem that is in NP have?
A correct solution can be verified in polynomial times
Big-O and Big-Thea
A function that is Theta(n) is always O(n)
One assumption made during the average case analysis
Any order of insertion of keys is equally likely to be used build the BST
Algorithm uses a queue as its primary data structure to stereo the nodes it must explore
BFS
Possible issue when using linear-probing?
Blocks of filled cells being to form
what should the find operations return when called on two elements that are in the same set?
Both calls should return the same answer
Which kind of AVL rotation are used by a red-black tree?
Both single and double rotation
Nodes in a Huffman code tree may have 3 children if there are ties in the occurrences count for some symbols.
False
Worst case to insert the N number of nodes to the trees
N
A treap is a BST with property that
Nodes satisfy heap order
The expected average deletion time for an element in treap is
O (log N)
When skip lists are used, the expected average running time of search and insert respectively are?
O(log N ) and O(log N)
The expected average insertion and search time for an element in treap is ?
O(log N)
What is the tightest runtime bound for the following loop? for(int i = 0; i < n; i *= 2){ count++; }
O(log n)
What color is a newly inserted node given?
Red
T or F: Iterating through unordered set does not allows you to access elements in sorted order
T
T or F: Skip lists require an estimate of the # of the elements that will be in the list so that the number of levels can be determined
T
Under what conditions will Dijkstra's algorithm not find the shortest path?
The graph has negative weights
In a disjoint set that is optimized using union-by-size, when merging two trees on a union operation, which tree do you set as the subtree of the other?
The smaller tree(with fewer nodes) should be the subtree.
Internal path length of a tree
The sum of the depth of all nodes in three
When constructing the Huffman tree using bottom up approach how do you select which trees to merge?
The two with lowest weight (frequency)
Which vertex will Dijkstra's algorithm select to process next?
The vertex with the lowest distance
Which is not true about Iterator?
They provide bounds check
An NP-complete problem has the property that any problem in NP can be polyominally reduced to it.
True
T of F: TST requires less memory compared to MWT
True
T or F: A suffix array can be implemented efficiently by taking advantage of pointers and shared memory
True
T or F: Separate chaining maintains list of all elements that hash to the same value
True
Which of the following are NP problems? 1. Hamiltonian circuit 2. Clique 3. Graph Coloring 4. Traveling salesman
all of them
An ifstream object will keep an internal put position
false
T or F: In a red-black tree, once a node has been assigned to a color, it can not be recolored
false
T or F; the more probable the symbol is, the longer is its huffman code
false
The root of a red-black tree should be red
false