VGPA203 Review

Ace your homework & exams now with Quizwiz!

Binary search tree

After inserting an item in a binary search tree, the resulting binary tree must be a(n) ____________________.

A null pointer

All node pointers that do not point to other nodes are set to:

A. B. and C

An operation that can be performed on a binary search tree is:

subtree

Any node and its descendants form a _______ of the original tree.

40

Assume the key of the left child below the root node of a binary search tree is 30. The value in the root node could be ____. A) 0 B) 10 C) 30 D) 40

Subtrees

Binary trees can be divided into:

A and B and C

Deleting a node that has two children offers an opportunity to use:

binary trees

Each node in a binary tree has at most two children (left child and the right child).

Two

Every node in a binary tree has at most _______ children A) One B) Two C) three D) four

The data in a node is greater than the data in the node's left subtree

For each node in a binary search tree: A. The data in a node is greater than the data in the node's left subtree B. The data in a node is less than the data in the node's right subtree

Leaf

If a tree only has one node, the root is a _______.

Larger than

In a binary search tree, the data in each node is ____ the data in the left child. A) Larger than B) Smaller than C) Equal to D) Larger or equal to

The root of the tree

In a binary tree class, you usually have a pointer as a member that is set to ________.

no, one, or two

In a binary tree, each node may point to ________ other nodes.

1

In a binary tree, the level of the children of the root node is ____. A) 0 B) 1 C) 2 D) 3

Immediate

In a graph directed G, for each vertex, v, the vertices adjacent to v are called ____ successors. A) Immediate B) Adjacent C) Path D) Parallel

More than one other node, plus the previous node in sequence

In a non-linear linked list, a node can point to:

levels

In a tree nodes are arranged in _______ that indicate the nodes' hierarchy.

Preorder

In a(n) ____________________ traversal, the binary tree is traversed as follows: 1. Visit the node. 2. Traverse the left subtree. 3. Traverse the right subtree.

Breadth first

In addition to the inorder, preorder, and postorder traversals, a binary tree can also be traversed level-by-level, which is also known as ____________________ traversal.

Adjacent

Let G be an undirected graph. Let u and v be two vertices in G. Then u and v are called ____ if there is an edge from one to the other. A) Adjacent B) Weighted C) Connected D) Shortest path

Incident

Let e (u, v) be an edge in an undirected graph G. The edge e is said to be ____________________ on the vertices u and v.

Root pointer

The ________ in a binary tree is similar to the head pointer in a linked list.

height

The ________ of a tree is the number of levels in the tree.

Height

The ____________________ of a binary tree is the number of nodes on the longest path from the root to a leaf.

Breadth first

The ____________________ traversal of a graph is similar to traversing a binary tree level by level.

Weight

The edges connecting two vertices can be assigned a non-negative real number, called the ____ of the edge. A) Key B) Weight C) Width D) Height

root node

The first node in a binary tree list is called the ________.

Pre-order traversal

The following pseudo-code fragment implements which type of binary tree traversal? Procedure Traverse (T) If (T != null) then { visit (root (T)); Traverse (T.left); Traverse (T.right); } End Traverse;

tree pointer

The head pointer, anchored at the top of a binary tree, is called the ________.

Recursion

The inorder, preorder, and postorder traversals can be accomplished using ________.

edges

The length of a path between nodes is the number of _______ that compose it.

Postorder sequence

The listing of the nodes produced by the postorder traversal of a binary tree is called the ____. A) Postsequence B) Postorder sequence C) Postorder table D) Post-script

Preorder sequence

The listing of the nodes produced by the preorder traversal of a binary tree is called the ____________________.

Traversing

The process of stepping through the nodes of a binary tree is known as ________.

Determined by the order in which values are inserted

The shape of a binary tree is ________.

Source

The starting vertex of a shortest path in a graph is called the ____________________.

D. Inorder, preorder, postorder

The three traversal algorithms discussed for binary trees are ____, ____, and ____. A) Order, preorder, postorder B) In, preorder, order C) Order, preorder, post D) Inorder, preorder, postorder

Root

The top level is a single node called the _____.

In-order

To print out the data in a binary search tree in an order that is sorted by the search key, which traversal would be used?

True

True or False: A binary tree has no cycles.

True

True or False: A graph might have cycles; therefore, we might not be able to traverse the entire graph from a single vertex.

False

True or False: A leaf node of a tree can have a non-empty sub-tree.

True

True or False: A simple path is a path in which all vertices, except possibly the first and last vertices, are distinct.

True

True or False: A subtree is an entire branch of a tree, from one particular node down.

True

True or False: After deleting the desired item from a binary search tree, the resulting tree must be a binary search tree.

True

True or False: All nodes to the right of a node hold values greater than the node's value.

true

True or False: Binary trees are commonly used to organize key values that index database records.

True

True or False: Deleting a leaf node from a binary tree is not difficult. Deleting a non-leaf node requires several steps.

True

True or False: Dereferencing a pointer to a pointer gives you another pointer.

False

True or False: Duplicates are allowed in a binary search tree.

false

True or False: In a binary tree, each node must have a minimum of two children

False

True or False: In a directed graph, the pairs (u,v) and (v,u) represent the same edge.

false

True or False: Output will be the same if you use inorder, postorder, or preorder traversals of the same binary tree

true

True or False: The binary tree structure is called a "tree" because it resembles an upside-down tree.

False

True or False: The depth first traversal is similar to the postorder traversal of a binary tree.

true

True or False: The height of a tree describes how many levels there are in the tree.

True

True or False: The height of a tree is always greater than the height of a sub-tree of any node of the tree.

True

True or False: The inorder method of traversing a binary tree involves traversing the node's left subtree, processing the node's data, and then traversing the node's right subtree.

True

True or False: The operations to do inorder, preorder, and postorder traversals of a binary search tree are the same as those for a binary tree.

True

True or False: The preorder method of traversing a binary tree involves processing the node's data, traversing the node's left subtree, then traversing the node's right subtree.

True

True or False: The two most common graph traversal algorithms are depth first traversal and breadth first traversal.

true

True or False: The width of a tree is the largest number of nodes in the same level.

false

True or False: To remove a node that has children, you must first remove the children.

False

True or False: We can always traverse an entire graph from a single vertex.

True

True or false: after deleting the desired item from a binary search tree, the resulting tree must be a binary search tree

False

True or false: all binary tree traversals start at the left-most child node

True

True or false: to delete an item from the binary search tree, you must do the following: 1. Find the node containing the item (if any) to be deleted 2. Delete the node.

(1) Left, (2) node's

Values are typically stored in a binary search tree so that a node's ________(1) child holds data is less than the ________(2) data.

Binary search tree

When a binary tree is used to facilitate a search, it is referred to as a ________.

the root node

When an application begins searching a binary tree, it starts at ________.

Child nodes, or children

When the root node points to two other nodes, the nodes are referred to as ________.

Root

When traversing a binary tree, the pointer current is initialized to _____. A. nullptr B. llink C. rlink D. Root

Is theoretically impossible in a correctly-developed binary tree structure

When working with a binary tree, a node that has more than two children:

Another pointer

When you dereference a pointer to a pointer, the result is:

True

true or false: the item search, insertion, and deletion operations all require the binary tree to be traversed

false

true or false:in a binary tree, the branches go only from a child to a parent

comparable

A binary search tree is a binary tree whose nodes contain __________ objects.

Two pointers, one for the left child and one for the right child

A binary tree can be created using a struct or class containing a data value and ________.

Graph

A binary tree is also a(n) A. stack B. linked list C. Graph D. Array

Three levels

A binary tree with a height of three has:

Hierarchical, or nonlinear

A classification where you categorize data into groups and subgroups:

To expedite the process of searching large sets of information

A good reason to use the binary tree structure is:

Subgraph

A graph H is called a(n) ____ of G if V(H) is a subset of V(G) and E(H) is a subset of E(G); that is, every vertex of H is a vertex of G, and every edge in H is an edge in G. A) Matrix B) Intersection C) Subgraph D) Union

Component

A maximal subset of connected vertices is called a ____ of G. A) Cycle B) Union C) Subset D) Component

Weight

A minimal spanning tree of G is a spanning tree with the minimum ____. A) Path B) Cycle C) Weight D) Height

leaf node

A node that has no children is known as a ________.

Parent, leaf

A node with children is a _______; a node without children is a _______.

Nodes, edges

A tree is a set of _______ connected by _______ that indicate relationships.

Free

A(n) ____ tree T is a simple graph such that if u and v are two vertices in T, a unique path exists from u to v. A) Rooted B) Free C) Spanning D) Weighted

Breadth first

A(n) ____________________ ordering of the vertices of the accompanying graph is 0, 1, 3, 4, 2, 5, 7, 8, 6, 9.

Depth first

A(n) ____________________ ordering of the vertices of the accompanying graph is 0, 1, 4, 3, 2, 5, 7, 8, 6, 9.


Related study sets

Disk Optimization/Troubleshooting

View Set

Iggy 10th Edition: Chapter 32: Concepts of Care for Patients With Cardiac Problems

View Set

English III- final exam S2 WATTS

View Set

Airport Ops, ATC and Federal Aviation Regulations

View Set

China Study Guide (Shang, Qin, Han)

View Set

Intracranial Regulation, Digestion, Endocrine - Passpoint

View Set