DS Ex 3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Consider the following tree. Use this text notation for the tree: (47 (19 (6, -), 58 (51, 62)). The - means the child does not exist. What is the tree after remove 51?

(47 (19 (6, -), 58 (-, 62)))

Consider the following tree. Use this text notation for the tree: (47 (19 (6, -), 58 (51, 62))). The - means the child does not exist. What is the tree after remove 19?

(47 (6, 58 (51, 62)))

Consider the following tree. Use this text notation for the tree: (47 (19 (6, -), 58 (51, 62))). The - means the child does not exist. What is the tree after remove 47?

(51 (19(6, -), 58 (-, 62)))

Consider the following graph, what is the path length of path B, D, E, A?

1.95

Consider the following graph, how many zeros are there on row J in the adjacency matrix of the graph?

10

Consider the following BST. Where will be a new node 18 be inserted?

12's right child

Consider the following graph. Using breadth first search, starts with vertex A. What | the distance of E (from A)?

2

Draw a BST by hand, inserting nodes one at a time, to determine a BST's height. A new BST is built by inserting nodes in this order: 6, 2, 8, 7, 9 What is the tree height? (Remember, root is at height 0)

2

The start vertex is A. In each main iteration, vertices in the graph are visited in the following order: A, B, C, D. What are B's values after the first iteration?

2/A

Using right, current, and left to do tree traversal (note: An inorder traversal uses left current right). Consider the following tree. Which node will be print out after 300?

201

Draw a BST by hand, inserting nodes one at a time, to determine a BST's height. A new BST is built by inserting nodes in this order: 6, 2, 9, 7, 8 What is the tree height? (Remember, the root is at height 0)

3

Given a max-heap with levels 0, 1. 2, and 3, with the last level not full, after inserting a new node, what is the maximum possible swaps needed

3

Consider the following BST. Where will be a new node 25 be inserted?

30's left child

Consider the following binary search tree, to search for a key in worst case, how many nodes are visited?

4

Consider the following binary tree, answer the question: There are ___ leaves. (type one number as answer)

4

Draw a BST by hand, inserting nodes one at a time, to determine a BST's height. A new BST is built by inserting nodes in this order. 2, 6. 9, 7, 8 What is the tree height? (Remember, the root is at height 0)

4

What is the maximum loop iterations to search a full binary tree with 15 nodes, if no node matches?

4

Consider the following BST. Determine cur's next assignment given the key is 75 and current node is 48.

62 cur = cur-›right

Consider do in order traversal of the following tree. Which node will be printed out after 300?

750

Consider do in order traversal of the following tree. How many nodes are visited?

8

Consider the following graph, how many zeros are there on row E in the adjacency matrix of the graph?

8

What is the maximum loop iterations to search a full binary tree with 255 nodes?

8

Consider the following binary tree, answer the question: The root is:

A

Consider the following graph, what is the adjacency list of vertex D?

A, B, E, H

Consider the following graph. Using depthth first search, Which is not a traversal of the graph?

A, D, F, C, B, E

After inserting a node into a tree, all tree nodes must have their balance factors updated.

False

For n nodes, an AVL tree has height equal to floor(log(n))

False

For non recursive DFS algorithm, it terminates once all vertices are added to visitedSet.

False

Refer to following graph, it has 6 vertices and 8 edges

False

The following graph is cyclic. B D C E

False

The following tree represent a max heap

False

Consider the following binary tree, answer the question: Which node has only one child?

G

Given a max-heap with n nodes, what is the complexity for removing the root?

O(log(n))

Given a max-heap with n nodes, what is the complexity of an insert, assuming an insert is dominated by the swaps?

O(log(n))

Rotate left at node 51. Where 60 will go?

n1

In AVL insert algorithm, when performing a double rotation (left-then-right), indicate new location for Y after initial (left) rotation:

n2

In AVL insert algorithm, when performing a double rotation (left-then-right), where is X after two rotations?

n2

Rotate right at node 53. Where 9 will go?

n2

Rotate left at node 51. Where 73 will go?

n3

In AVL insert algorithm, when performing a double rotation (left-then-right), indicate new location for X after initial (left) rotation:

n4

A max-heap's root must have the maximum key

True

Conceivably, inserting 100 items into an AVL tree may not require any rotations.

True

Dijkastra's algorithm may not find the shortest path for graphs with negative edge weigh.

True

Dijkstra's shortest path algorithm can be used for unweighted graphs, in which all edges have a uniform weight of 1. A vertex's distance is the number of edges in the shortest path from the start vertex.

True

Dijkstra's shortest path algorithm, created by Edsger Dijkstra, determines the shortest path from a start vertex to each vertex in a graph.

True

In following tree, the height difference of B's right subtree and left subtree is 2

True

Refer to following graph, the distance from D to C is 3

True

Refer to following graph. A and B are adjacent.

True

The following graph is acyclic. B D C E

True

The following tree doesn't represent a max heap since the node 60 violate the max-heap property

True


संबंधित स्टडी सेट्स

Active Volcano; Eruption Duration; Eruption Size

View Set

C727 - Cybersecurity Management I - Strategic

View Set

Good Clinical Practice Course (Medical Clinical Research)

View Set

[Lección 2] Estructura 4.3 - Mi universidad

View Set