solano cis 23 test 4 2024

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

Using big O notation, say how long it takes (ideally) to find an item in a hash table.

O(1)

True or False: A possible hash function for strings involves multiplying each character by an ever-increasing power.

True

True or False: The rule in Dijkstra's algorithm is to always put in the tree the vertex that is closest to the starting vertex.

True

True or False: There may be many correct topological sorts for a given graph.

True

A node is always removed from the __________.

root

If digit folding is used in a hash function, the number of digits in each group should reflect _____________.

the array size

In the MST algorithm, what is removed from the priority queue?

the lowest-weight (cheapest) edge

In external hashing, all records with keys that hash to the same value are located in ___________.

the same block

A ______ is a graph with no cycles.

tree

Insertion into a descending heap involves trickle _____.

up

A heap is to a priority queue as a(n) _______ is to a stack.

array (or linked list)

True or False: In external hashing, it's important that the records don't become full.

False

True or False: In linear probing an unsuccessful search takes longer than a successful search.

False

True or False: The shortest-path problem (SPP) must be carried out on a directed graph.

False

True or False: The weight of the MST depends on the starting vertex.

False

What are the first five step sizes in quadratic probing?

1, 4, 9, 16, 25 (1^2, 2^2, 3^2, 4^2, 5^2)

A reasonable load factor in separate chaining is ________.

1.0

What is an approximate big O time for an attempt to solve the knight's tour?

2N, where N is the number of squares on the board minus 1

How many different minimum spanning trees are there in an undirected graph of three vertices and three edges?

3

What's a DAG?

A directed acyclic graph

If an adjacency matrix has rows {0,1,0,0}, {1,0,1,1}, {0,1,0,0}, and {0,1,0,0}, what is the corresponding adjacency list?

A:B, B:A—>C—>D, C:B, D:B

What does the term weakly ordered mean when applied to heaps?

Both the right and left children have keys less than (or equal to) the parent.

How do you tell, by looking at its adjacency matrix, how many edges there are in an undirected graph?

Count the number of 1s and divide by 2 (assuming the identity diagonal is all 0s).

Can a minimum spanning tree for an undirected graph have cycles?

No

In Figure 14.13, is the route ABCEDA the minimum solution for the traveling salesman problem?

No

Can a tree have cycles?

No, by definition

What evidence does the topo.java program (Listing 13.4) use to deduce that a graph has a cycle?

Some vertices remain, but none have no successors.

Floyd's algorithm is to weighted graphs what _______ is to unweighted graphs.

Warshall's algorithm

Dijkstra's algorithm finds the shortest path a. from one specified vertex to all other vertices. b. from one specified vertex to another specified vertex. c. from all vertices to all other vertices that can be reached along one edge. d. from all vertices to all other vertices that can be reached along multiple edges.

a. from one specified vertex to all other vertices.

In separate chaining the time to insert a new item a. increases linearly with the load factor. b. is proportional to the number of items in the table. c. is proportional to the number of lists. d. is proportional to the percentage of full cells in the array.

a. increases linearly with the load factor.

A heap can be represented by an array because a heap a. is complete. b. is weakly ordered. c. is a binary tree. d. satisfies the heap condition.

a. is complete.

A minimum spanning tree is a graph in which a. the number of edges connecting all the vertices is as small as possible. b. the number of edges is equal to the number of vertices. c. all unnecessary vertices have been removed. d. every combination of two vertices is connected by the minimum number of edges.

a. the number of edges connecting all the vertices is as small as possible.

To "trickle up" a node in a descending heap means a. to repeatedly exchange it with its parent until it's larger than its parent. b. to repeatedly exchange it with its child until it's larger than its child. c. to repeatedly exchange it with its child until it's smaller than its child. d. to repeatedly exchange it with its parent until it's smaller than its parent.

a. to repeatedly exchange it with its parent until it's larger than its parent.

In the railroad fares example, a fringe town is one a. to which the distance is known, but from which no distances are known. b. which is in the tree. c. to which the distance is known and which is in the tree. d. which is completely unknown.

a. to which the distance is known, but from which no distances are known.

Floyd's algorithm uses the ________ representation of a graph.

adjacency matrix

What does the term complete mean when applied to binary trees? a. All the necessary data has been inserted. b. All the rows are filled with nodes, except possibly the bottom one. c. All existing nodes contain data. d. The node arrangement satisfies the heap condition.

b. All the rows are filled with nodes, except possibly the bottom one.

In the cable TV example, each edge added to the MST connects a. the starting vertex to an adjacent vertex. b. an already-connected city to an unconnected city. c. the current vertex to an adjacent vertex. d. two cities with offices.

b. an already-connected city to an unconnected city.

The all-pairs shortest-path problem involves finding the shortest path a. from the starting vertex to every other vertex. b. from every vertex to every other vertex. c. from the starting vertex to every vertex that is one edge away. d. from every vertex to every other vertex that is one or more edges away.

b. from every vertex to every other vertex.

Heapsort involves a. removing data from a heap and then inserting it again. b. inserting data into a heap and then removing it. c. copying data from one heap to another. d. copying data from the array representing a heap to the heap.

b. inserting data into a heap and then removing it.

Secondary clustering occurs because a. many keys hash to the same location. b. the sequence of step lengths is always the same. c. too many items with the same key are inserted. d. the hash function is not perfect.

b. the sequence of step lengths is always the same.

The last node in a heap is a. always a left child. b. always a right child. c. always on the bottom row. d. never less than its sibling.

c. always on the bottom row.

An undirected graph must have a cycle if a. any vertex can be reached from some other vertex. b. the number of paths is greater than the number of vertices. c. the number of edges is equal to the number of vertices. d. the number of paths is less than the number of edges.

c. the number of edges is equal to the number of vertices.

Open addressing refers to a. keeping many of the cells in the array unoccupied. b. keeping an open mind about which address to use. c. probing at cell x+1, x+2, and so on until an empty cell is found. d. looking for another location in the array when the one you want is occupied.

d. looking for another location in the array when the one you want is occupied.

The best technique when the amount of data is not well known is a. linear probing. b. quadratic probing. c. double hashing. d. separate chaining.

d. separate chaining.

In a weighted graph, the minimum spanning tree (MST) tries to minimize a. the number of edges from the starting vertex to a specified vertex. b. the number of edges connecting all the vertices. c. the total weight of the edges from the starting vertex to a specified vertex. d. the total weight of edges connecting all the vertices.

d. the total weight of edges connecting all the vertices.

Topological sorting results in a. vertices arranged so the directed edges all go in the same direction. b. vertices listed in order of increasing number of edges from the beginning vertex. c. vertices arranged so A precedes B, which precedes C, and so on. d. vertices listed so the ones later in the list are downstream from the ones earlier.

d. vertices listed so the ones later in the list are downstream from the ones earlier.

A directed graph is one in which a. you must follow the minimum spanning tree. b. you must go from vertex A to vertex B to vertex C and so on. c. you can go in only one direction from one given vertex to another. d. you can go in only one direction on any given path.

d. you can go in only one direction on any given path.

In a graph, an _______ connects two _________ .

edge, nodes (or vertices)

The weight in a weighted graph is a property of the graph's _______.

edges

A __________ transforms a range of key values into a range of index values.

hash function

The MST algorithm "prunes" an edge from the list when the edge leads to a vertex that _________ .

is already the destination of an edge with a lower weight

Using the next available position after an unsuccessful probe is called _____________.

linear probing

Separate chaining involves the use of a _____________ at each location.

linked list

In a game simulation, what graph entity corresponds to a choice about what move to make?

node

How many arrays, each big enough to hold all the data, does it take to sort a heap?

one


Conjuntos de estudio relacionados

Families and Children (Chapter 9)

View Set

Course 3 Module 12: Efficient Market Theory

View Set

EAQ-MedSurg-CV, Hemat, & Lymph Systems

View Set

MKT 291 Chapter 1-6 Learning Objectives

View Set

Chapter 12 Quiz - Intermediate Accounting 2

View Set