CS 3050 Final Exam Review

¡Supera tus tareas y exámenes ahora con Quizwiz!

Assuming the functions BuildHeap(), Heapify(), Swap(), and the passed-in CompareFunc() are all implemented correctly, what will this function do? void heapsort(void *array, size_t nitems, size_t size, int (*CompareFunc)(const void *, const void*)) { void * A = array; BuildHeap(array,nitems,size,CompareFunc); for (int i=nitems 1;i>0;i ) { //Swap(&(A[0]),&(A[i]),size); Swap(A,A+i*size,size); nitems--; Heapify(array,0,nitems,size,CompareFunc); } } a. It will modify the contents of the input array so that all elements are in sorted order. b. It will create a new array called A that has the elements from the input array in sorted order. c. It will simply reverse the contents of the input array due to the Swap() call. d. It will run off the end of the output array (which might cause a segfault). e. This will not compile.

a

During a heap sort operation, what is the maximum number of elements that can be stored at depth d of a complete binary tree? a. 2^d b. 2^(d-1) c. 2^d elements at depth d d. 2^(h-d) where h is the height of the tree

a

How does Kruskal's algorithm determine the next edge to add to the growing forest? a. By choosing the shortest available edge that does not form a cycle b. By selecting edges randomly until the tree is formed c. By using a priority queue to select the maximum weight edge d. By starting from the vertex with the highest degree e. By choosing the longest available edge to create balance

a

If one has a balanced BST of 1024 nodes, and one wishes to find a node with key=k, approximately what is the worst case number of nodes one will visit when searching for an arbitrary k that exists in the BST? a. 10 b. 20 c. 256 d. 512 e. 1024

a

If one were to represent a heap in array format (as shown in class and A1), what is the index of the right child of a node whose index is i? a. 2*i+1 b. 2*i c. i/2 d. floor(lg(i)) e. None of these

a

In the context of minimum spanning trees, what is a key feature of Kruskal's algorithm? a. It requires checking for cycles using a union-find structure. b. It selects edges based on their weight from smallest to largest until the tree is complete. c. It begins from a random vertex and expands the tree greedily. d. It works exclusively with undirected graphs. e. It utilizes a max-heap to select edges.

a

Of the data structures we have considered so far in class, the variable called "nodes" (below) is an array of which of the following? typedef struct { int key; int next; } NODE; NODE nodes[256]; a. Singly Linked List b. Doubly Linked List c. Dictionary d. Heap e. None of these

a

Recall the example from the slides of "absorbing" all red nodes into their parent black nodes. After doing this to any red-black tree, what is the maximum difference between the depth of any two leaves of the resulting tree? a. 0 b. 1 c. 2 d. lg n e. None of these

a

The following is the body of a function used on a BST. What does the function return? if right[x] != NIL then return Tree-Minimum(right[x]) y <- p[x] while y != NIL and x = right[y] do x <- y y <- p[y] return y a. The successor of x b. The predecessor of x c. The minimum of the sub-tree starting at x d. The maximum of the sub-tree starting at x e. None of these.

a

What does the statement "A is at least O(n^2)" mean? a. Nothing b. A has a lower bound of n^2 c. A is a member of the set Θ(A) d. A has an upper bound of n^2 e. A is a member of the set Ω(A)

a

What is a "Direct-address Table"? a. An array b. A heap c. A hash table d. A linked list e. A binary search tree

a

What is the "Big Theta" (Θ) of writing a value to a "Direct-address Table"? a. Θ(1) b. Θ(n) c. Θ(n^2) d. Θ(n^3) e. Θ(n * log n)

a

What kind of graph is used to find strongly connected components using Kosaraju's algorithm? a. Directed graph b. Undirected graph c. Weighted graph d. Bipartite graph e. Complete graph

a

When you were writing the Insertion Sort in our first homework assignment, the prototype looked similar to this: void insertionsort(void *array,size_t nitems,size_t size,int (*CompareFunc)(const void *, const void*)); If you wanted to use this function to sort two arrays of integers, what might the implementation of the comparison function look like? a.int IntCompare(const void *p1, const void *p2) { int a = *((int *)p1); int b = *((int *)p2); return a-b; } b.int IntCompare(const void *p1, const void *p2) { int a = *((int *)p1); int b = *((int *)p2); return a>b; } c.int IntCompare(const void *p1, const void *p2) { int a = *((int *)p1); int b = *((int *)p2); return b-a; } d.int IntCompare(const void *p1, const void *p2) { int a = ((int *)p1); int b = ((int *)p2); return a==b; } e.bool IntCompare(const void *p1, const void *p2) { int a = *((int *)p1); int b = *((int *)p2); return b==a; }

a

Which is a "Big Theta" (Θ) of f(n) = 5n + 2/n - 7? a. Θ(n) b. Θ(n^2) c. Θ(n^3) d. Θ(n * log n) e. Θ(2^n)

a

Which of these is true of "pseudocode"? a. Pseudocode usually has a syntax roughly similar to popular programming languages. b. Pseudocode must include error-handling and other real-world software engineering challenges. c. Pseudocode cannot include unstructured English as this would be too inexact. d. All of the above (a, b, and c) e. None of the above

a

Given the following recurrence relation, what is the "Big Theta" bound? T(n) = 2T(n/2) + 10n a. Θ(n) b. Θ(n * log n) c. Θ(n^2) d. Θ(n^3) e. Θ(2^n)

b

If one had a unique "key" for some set of data that one wished to store, why hash that key? a. There is no need to hash the key. Just use the key as an index into an array to store the data. b. Hashing the key could allow the array used to store the data to be significantly smaller. c. Hashing the key could allow you to more quickly find the data in a linked list. d. Hashing the key could guarantee uniqueness. e. Hashing the key could clean up invalid keys.

b

If one were to try to implement a singly linked list in a language that lacks pointers, one could... a. Use an array of Nodes where "next" is a pointer to another Node or is Nil (NULL). b. Use an array of Nodes where "next" is an unsigned integer index into the array or is a sentinel meaning Nil. c. Use a head pointer to a Node whose "next" is a pointer to another Node or is Nil (NULL). d. Use a BST, and just ignore the "right" pointer (use only the "left" pointer). e. It is not possible to implement a linked list without pointers.

b

In the context of graph theory, what does the "Breadth-First Search" (BFS) algorithm typically use to keep track of the next vertex to explore? a. A stack b. A queue c. A priority queue d. A set

b

In the context of interval trees, what is the purpose of the IntervalSearch function? a. To find an exact match for a given interval b. To search for an interval that overlaps with a given interval c. To return all intervals that are contained within a given interval d. To update the intervals in the tree e. To balance the interval tree

b

The following is the body of a function used on a BST. What does the function return? if left[x] != NIL then return Tree-Maximum(left[x]) y = p[x] while y!= NILL and x = left[y] do x = y y=p[y] return y a. The successor of x b. The predecessor of x c. The minimum of the sub-tree starting at x d. The maximum of the sub-tree starting at x e. None of these.

b

What color is the root of a red-black tree? a. Red b. Black c. Uncolored (special case) d. Both red and black (special case) e. It depends on how the tree was built (data inserted, deleted, etc.)

b

What does the "min-heap property" ensure about the parent and child nodes in a heap? a. The parent is always less than or equal to the child b. The parent is always greater than or equal to the child c. The parent and child are always equal d. The parent and child have no value relation e. The child is always greater than the parent

b

What does the RB-Insert-Fixup() procedure do? a. It updates the metadata of nodes, such as size or maximum values, without altering the tree's structure. b. Corrects red-black property violations created during the RB-Insert() procedure. c. It searches for a node in the tree and returns its value. d. It deletes a node from the tree and then rebalances it. e. None of these.

b

What is the "Big Theta" of searching a Doubly Linked List? a. Θ(1) b. Θ(n) c. Θ(n log n) d. Θ(n^2) e. Θ(n^3)

b

What is the "Big Theta" of searching a Singly Linked List? a. Θ(1) b. Θ(n) c. Θ(n log n) d. Θ(n^2) e. Θ(n^3)

b

What is the primary advantage of using a red-black tree over a regular binary search tree? a. Red-black trees allow faster insertion and deletion operations. b. The structure of a red-black tree ensures it remains balanced. c. Red-black trees do not require tree rotations. d. There is no advantage; both trees offer the same performance.

b

What is this hashing method called? h(k) = |_m(kA - |_kA_|)_| a. Division method b. Multiplication method c. Knuth method d. Floor method e. No name is commonly used, though this is a recommended way to calculate h(k)

b

What sort that we discussed might this code implement? { int j; void * dest; void * src; void * key = malloc(size); for (int i=1;i<nitems;i++) { //key = a[i]; dest = key; src = array + size*i; Copy(dest,src,size); j = i-1; //while (j>=0 && a[j]>key) while (j>=0 && CompareFunc(array+j*size,key)>0) { //a[j+1] = a[j]; dest=array+size*(j+1); src = array+size*j; Copy(dest,src,size); j--; } //a[j+1] = key; dest = array+size*(j+1); src = key; Copy(dest,src,size); } } a. Bubble Sort b. Insertion Sort c. Heap Sort d. Quick Sort e. None of these

b

Which algorithm adjusts the predecessors of vertices during its execution? a. Prim's Algorithm b. Dijkstra's Algorithm c. Kruskal's Algorithm d. Breadth-First Search e. Depth-First Search

b

Which is a "Big Theta" (Θ) of Insertion Sort? a. Θ(n) b. Θ(n^2) c. Θ(n^3) d. Θ(n * log n) e. Θ(2^n)

b

Which is the "Big Theta" (Θ) of f(n) = 5n^2 + 2000n + 5? a. Θ(n) b. Θ(n^2) c. Θ(n^3) d. Θ(n * log n) e. Θ(2^n)

b

Which of the following best describes the "Theta (Θ)" notation in asymptotic analysis? a. It denotes an upper bound that is not asymptotically tight. b. It indicates the exact asymptotic behavior. c. It represents a growth rate smaller than any polynomial. d. It denotes a lower bound that is not asymptotically tight.

b

Which of the following is a correct statement about the result of Prim's algorithm? a. It results in the shortest possible path between two nodes b. It results in a minimum spanning tree c. It results in a maximum spanning tree d. It results in the longest possible path through the graph e. It checks all possible paths before execution

b

Which of the following is true (if any)? a. It is faster to delete a node from a singly linked list than a doubly linked list. b. It is faster to delete a node from a doubly linked list than a singly linked list. c. It is equally fast to delete a node from a singly linked list or a double linked list. d. It is not possible to delete a node from a doubly linked list. e. It is not possible to delete a node from a singly linked list.

b

Which of these is one of the "red-black properties" of red-black trees? a. If a node is red, then one of its children is black. b. If a node is red, then both of its children are black. c. If a node is black, then one of its children is red. d. If a node is black, then both of its children are red. e. None of these.

b

An advantage of a chained hash table over open addressing is a. Worst case complexity of search is less b. Space used is less c. Deletion is easier d. All of these are advantages e. None of these are advantages

c

Consider a problem that can be solved using "Divide and Conquer" such that the overall problem can be solved by solving 3 sub-problems each working against ½ of the original data. To combine the solutions takes f(n) = n2 time. What is the "Big Theta" bound of the overall solution? a. Θ(n) b. Θ(n * log n) c. Θ(n^2) d. Θ(n^3) e. Θ(2^n)

c

Consider the Master Theorem for solving recurrences commonly used in analyzing divide and conquer algorithms. Given the recurrence relation T(n) = 9T(n/3) + n^2, what is the asymptotic behavior of T(n) according to the Master Theorem? a. T(n) = Θ(n^2 log n) b. T(n) = Θ(n^2) c. T(n) = Θ(n^(log_3 9)) d. T(n) = Θ(n^(log_3 9) log n)

c

Consider the following two Search algorithms for searching a BST. Which statement is true? Tree-Search(x, k) if x = NIL or k = key[x] then return x if k < key[x] then return Tree-Search(left[x], k) else return Tree-Search(right[x], k) Iterative-Tree-Search(x, k) while x != NIL and k != key[x] do if k < key[x] then x <- left[x] else x <- right[x] return x a. From a "Big O" perspective, Tree-Search() is faster. b. From a "Big O" perspective, Iterative-Tree-Search() is faster. c. Tree-Search() will generally use more memory. d. Iterative-Tree-Search() will generally use more memory. e. None of these is true.

c

Given the following binary tree, which of these is a pre-order traversal? 6 / \ 2 11 / \ / \ 1 5 10 39 / / 7 25 a. 1,2,5,6,7,10,11,25,39 b. 1,5,2,7,10,25,39,11,6 c. 6,2,1,5,11,10,7,39,25 d. Each of these is a pre-order traversal, since this is not a BST e. None of these is a pre-order traversal

c

If the following code is applied to a BST passing in a node "x" initially, what does it do? while left[x] != NIL do x <- left[x] return x a. Finds the successor of the original x. b. Finds the predecessor of the original x. c. Finds the minimum key for the tree rooted at the original x. d. Finds the maximum key for the tree rooted at the original x. e. None of these is correct.

c

If you were to take an array filled with n random integers, iteratively insert each integer into a BST (which started out as empty), and then do an inorder traversal of that BST, what would the asymptotic bound of the average running time of this procedure be? a. Θ(n) b. Θ(log n) c. Θ(n * log n) d. Θ(n^2) e. Θ(n^2 * log n)

c

In a binary search tree, what property do the left children of a node typically satisfy? a. They are equal to the node b. They are greater than the node c. They are less than the node d. They have no specific order relation to the node e. They are the same height as the node

c

Recall the example from the red-black tree slides of "absorbing" all red nodes into their parent black nodes. After doing this to any red-black tree, how many children will an internal black node have? a. 0 b. 1 to 4 c. 2 to 4 d. 3 to 4 e. 4

c

The height h of a red-black tree is proven less than or equal to which of these? a. log (n) b. log (n + 1) c. 2 log(n + 1) d. 2 log(n - 1) e. None of these

c

The total number of nodes in a perfect binary tree of height 4 is a. 7 b. 8 c. 15 d. 16 e. 17

c

What characteristic does a red-black tree use to maintain balance? a. Nodes are added randomly to ensure balance. b. Nodes have assigned weights that guide the tree's structure. c. Every path from a node to its descendant leaves has the same number of black nodes. d. All leaf nodes are at the same depth. e. Leaf nodes can have any color as long as the root is black.

c

What distinguishes Breadth-First Search (BFS) from Depth-First Search (DFS) in terms of their exploration strategy? a. BFS explores vertices depthwise, while DFS explores them breadthwise. b. BFS uses a stack to track vertices, while DFS uses a queue. c. BFS can find the shortest path in unweighted graphs, while DFS cannot. d. BFS cannot be used for tree traversal, while DFS can. e. BFS always visits nodes in numerical order, while DFS does not.

c

What does the OS-Select function in augmented data structures typically return? a. The size of the tree b. The maximum element in the tree c. The ith smallest element in the tree d. The root element of the tree e. The height of the tree

c

What does the heap property ensure in a min-heap data structure? a. Every parent node has a value greater than or equal to its children. b. The largest element is at the bottom of the heap. c. Each node has a value less than or equal to its parent node's value. d. The heap is a balanced binary tree.

c

What does the strongly connected components (SCC) algorithm help to identify in a graph? a. Isolated vertices b. Maximum distances between vertices c. Groups of vertices that are mutually reachable d. The shortest path between any two vertices e. The lightest edges in the graph

c

What is a key characteristic of Prim's algorithm for finding a minimum spanning tree? a. It begins from the highest-weight edge b. It requires the graph to be directed c. It grows a single tree by adding the cheapest possible connection to the tree d. It allows cycles to form during execution e. It requires sorting all edges beforehand

c

What is the "Big Theta" (Θ) of deleting a node from a red-black tree? a. Θ(1) b. Θ(n) c. Θ(log n) d. Θ(n log n) e. Θ(n^2)

c

What is the "Big Theta" (Θ) of inserting a node into a red-black tree? a. Θ(1) b. Θ(n) c. Θ(lg n) d. Θ(n lg n) e. Θ(n^2)

c

What is the color assigned to vertices that are being currently visited in Depth-First Search? a. White b. Black c. Grey d. Red e. Blue

c

What is the primary purpose of augmenting data structures? a. To simplify the underlying data structure b. To provide additional functionality without altering the data structure c. To enhance the existing data structure with additional information d. To replace the need for traditional data structures e. To reduce the space complexity of the data structure

c

What is typically the outcome of executing a topological sort on a directed acyclic graph (DAG)? a. All nodes are sorted by their incoming edges b. All nodes are sorted by their outgoing edges c. A possible order for all nodes that respects the directions of the edges d. Random order of nodes e. All nodes are grouped by connectivity

c

What operation is primarily used during the execution of Dijkstra's algorithm to ensure the shortest paths are updated correctly? a. Insertion b. Deletion c. Relaxation d. Aggregation e. Compression

c

What problem does Dijkstra's algorithm solve? a. Finding the longest path in a graph b. Calculating the maximum flow in a network c. Finding a shortest path from a single source to all other vertices d. Identifying negative weight cycles in a graph e. Determining all-pairs shortest paths

c

Which graph traversal method uses a queue to manage the vertices to be explored? a. Depth-First Search b. Interval Search c. Breadth-First Search d. Binary Search e. Linear Search

c

Which is a property of a good hash function? a. Random - h(x) should not return predictable values in order to thwart "adversaries". b. High cost - h(x) should be expensive to calculate in order to prevent "brute force" attacks. c. Uniform - h(x) should be equally likely to give each value in the target range. d. Delicious - h(x) should be pleasant to taste and pair nicely with wine. e. None of these is a property of a good hash function.

c

Which is not an operation that defines a "Dictionary" Abstract Data Type (ADT)? a. Create b. Destroy c. Rebuild d. Insert e. Find

c

Which is the "Big Theta" (Θ) of the "Heapify" function?* a. Θ (n) b. Θ(n^2) c. Θ(log n) d. Θ(n * log n) e. Θ(2^n)

c

Which of the following is a true statement? a. Ω(f(n)) is a subset of Θ(f(n)) b. O(f(n)) is a subset of Ω (f(n)) c. Θ(f(n)) is a subset of Ω (f(n)) d. All of these are true e. None of these are true

c

Which of the following is true of two programs whose execution time is given by the functions f(n) = 2^n and g(n) = n^3 respectively. a. f(n) is always larger (takes longer to run) than g(n). b. g(n) is always larger (takes longer to run) than f(n). c. f(n) is larger (takes longer to run) than g(n) when n is very large, but not when n is very small. d. g(n) is larger (takes longer to run) than f(n) when n is very large, but not when n is very small. e. None of the above are true.

c

Which property must always be true for a binary search tree (BST)? a. The left subtree of any node contains only nodes with keys greater than the node's key. b. The value of a node is at most the value of its children. c. For all nodes x, all keys in the right subtree are greater than key[x]. d. A BST cannot contain duplicate elements.

c

Which sorting algorithm is considered stable by default? a. QuickSort b. HeapSort c. MergeSort d. BubbleSort

c

Which traversal method lists nodes according to their finishing times in a depth-first search? a. Inorder traversal b. Level-order traversal c. Postorder traversal d. Preorder traversal e. Symmetric order traversal

c

Consider a node x in a red-black tree. If x has 2 children (right(x) and left(x)), which is true of the bh(x)? a. bh(x) = max(bh(right(x)), bh(left(x))) + 1 b. bh(x) = bh(right(x)) + 1 c. bh(x) = bh(left(x)) + 1 d. All of the above e. None of the above

d

If a program's worst-case runtime is characterized by f(n) = 7n^3 + 100n^2 - 20n +6 and its best-case runtime is characterized by f(n) = 100n^2 - 20n +6 what is Ω(f(n))? a. Ω(n4)? b. Ω(n2)? c. Ω(n)? d. Both b and c are correct e. None of the above are correct

d

If one has a singly linked list of 1024 nodes, and one wishes to find a node with key=k, approximately what is the average number of nodes one will visit when searching for an arbitrary k that exists in the list? a. 10 b. 20 c. 256 d. 512 e. 1024

d

If one has a singly linked list of 1024 nodes, and one wishes to find a node with key=k, approximately what is the average number of nodes one will visit when searching for an arbitrary k? a. 10 b. 20 c. 256 d. 512 e. 1024

d

If one were writing a hashing function using the "Division method" to hash to a table with 100 entries, why is h(k) = k mod 8 considered to be a poor choice of hashing functions? a. It should be k / 8 (integer division) instead of using mod. b. 8 is considered too small relative to the table size. c. 8 is considered too large relative to the table size. d. 8 is a power of 2. e. This is a reasonable choice for h(k) if using the "Division method".

d

If the longest path from a node x to a descendant leaf is L in length, the shortest path must be at least which of these? a. L b. L - 1 c. L - 2 d. L / 2 e. None of these.

d

In order to hash a "record" or "structure", you must a. Turn all of the data into a string b. Turn all of the data into a number c. Turn all or part of the data into a string d. Turn all or part of the data into a number e. It is not possible to hash a "record" or "structure"

d

In the context of hashing, what does the division method do? a. Multiplies a key by a constant fractional value. b. Assigns a hash based on the sum of a key's characters. c. Adjusts the size of the hash table based on the load factor. d. Computes a hash by taking the remainder of a key divided by the table size.

d

Other than CPU execution speed, what else should one consider with regard to "efficiency" in a real-world setting? a. Memory usage b. Disk usage c. Communication bandwidth d. All of the above (a, b, and c) e. None of the above (The term "efficiency" is only applicable to execution speed)

d

Suppose a node is inserted into a red-black tree and then immediately deleted. Is the resulting red-black tree the same as the original? a. Yes. It will be exactly the same b. No. The shape can change, though the coloring will remain the same. c. No. The coloring can change, but the shape will remain the same. d. No. Both the shape and coloring can change. e. None of these.

d

The total number of nodes in a complete binary tree of height 5 is a. 15 b. 31 c. 32 d. 63 e. 64

d

What data structure is most commonly used to implement Dijkstra's algorithm efficiently? a. Array b. Linked List c. Binary Search Tree d. Priority Queue e. Stack

d

What is the "Big O" of the worst case for quicksort? a. O(1) b. O(n) c. O(n lg n) d. O(n^2) e. O(n^3)

d

What is the primary benefit of using a hash table with a good hash function? a. Faster access to elements compared to using an array b. Increased storage space for elements c. Elimination of all possible collisions d. Even distribution of elements across the table e. Ability to store multiple data types

d

Which (if any) of the following "C" arrays represents a valid "heap"? a. int a[]={16,14,10,8,7,9,3,2,4,1} b. int a[]={16,14,10,8,7,9,3,4,2,1} c. int a[]={16,14,10,8,7,3,9,4,1,2} d. All of these are valid heaps e. None of these are valid heaps

d

Which algorithm is often used to prepare a graph for algorithms that find strongly connected components? a. Kruskal's Algorithm b. Prim's Algorithm c. Breadth-First Search d. Depth-First Search e. Dijkstra's Algorithm

d

Which collision resolution technique involves creating a linked list for each entry in the hash table? a. Open addressing b. Quadratic probing c. Double hashing d. Chaining

d

Which is a "Big Theta" (Θ) of f(n) = 2^(n+1) a. Θ(n) b. Θ(n^2) c. Θ(n * log n) d. Θ(2^n) e. None of these is sufficient to bound f(n)

d

Which is the "Big Theta" (Θ) of f(n) = 2^n+3 a. Θ(n) b. Θ(n^2) c. Θ(n * log n) d. Θ (2^n) e. None of these is sufficient to bound f(n)

d

Which of the following best describes the output of a topological sort? a. An array of vertices sorted by their labels b. A sequence of vertices based on the increasing order of finish times in a DFS c. A sequence of vertices in non-decreasing order of their discovery times d. An ordering of vertices such that for every directed edge uv, vertex u comes before v e. An array of vertices sorted by their degree

d

Which of the following could not be contained as "satellite data" in a linked list? a. An integer b. A string c. A linked list d. All of these could be contained as satellite data in a linked list. e. None of these could be contained as satellite data in a linked list.

d

Which of the following is false about a binary search tree, assuming that tree contains no duplicate values? a. The key of the left child is always less than the key of the parent. b. The key of the right child is always greater than the key of the parent. c. The left and right sub-trees of any node are also binary search trees. d. None of these are false. e. All of these are false.

d

Which of these function prototypes might be appropriate to search a "Dictionary" ADT? Assume the C programming language, Dictionary is the type of the "Dictionary" ADT, and a "Customer" is: typedef struct {int cust_no; char name[256];} Customer; a. Customer Find(Dictionary D, char * name); b. char * Find(Dictionary D, Customer c); c. Customer Find(Dictionary D, char name[]); d. All of these are appropriate prototypes to search a Dictionary ADT. e. None of these prototypes would be appropriate for searching a Dictionary ADT.

d

Which of these is proven to be true about the height (h) of a red-black tree with relation to its number of nodes (n)? a. h = log(n) b. h = 2 log(n) c. h <= 2 log(n) d. h <= 2 log(n+1) e. h >= 2 log(n) + 1

d

Which operations can be performed in O(log n) time on a red-black tree? a. Search b. Insert c. Delete d. All of these e. None of these

d

Which property must always be true for a binary search tree (BST)? a. The left subtree of any node contains only nodes with keys greater than the node's key. b. The value of a node is at most the value of its children. c. A BST cannot contain duplicate elements. d. For all nodes x, all keys in the right subtree are greater than key[x].

d

During which graph traversal is each vertex colored black after all its descendants are explored? a. Breadth-First Search b. Preorder Traversal c. Postorder Traversal d. Inorder Traversal e. Depth-First Search

e

Who wrote "The Art of Computer Programming"? a. Ronald Rivest b. Alan Kay c. Edsgar Djikstra d. Grace Hopper e. Donald Knuth

e


Conjuntos de estudio relacionados

Capstone Final (Chapters 6, 7, 8, 9, 10, 11)

View Set

Chemistry Exam 2, Chemistry Quiz 1.1- 1.3, Expectations, Chem Quiz (1.4-1.10, Lab Safety Rules, Lab equipment, Verses), Chemistry Quiz Chapter 2, Chapter 3 Chemistry Quiz, Symbols and Elements, Chapter 4 Chemistry Quiz, Chemistry Review Worksheet, Ch...

View Set

Chapter 39: Nursing Care of the Child With an Alteration in Sensory Perception/Disorder of the Eyes or Ears

View Set

CYBER SECURITY RISK MANAGEMENT ITEC433

View Set