• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/55

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

55 Cards in this Set

  • Front
  • Back

Solves an instance of a problem by first solving one or more smaller instances

Recursive Algorithm

A way of organizing information in memory

Data Structure

The mathematical entity a queue is based on

Sequence

The mathematical entity the dictionary ADT is based on

set

A set of vertices and a set of edges

Graph

This ADT manages data by position

list

The number of edges in a tree with N nodes

N-1

Length of path ABCD in an unweighted graph

3

A directed graph with no directed edges

DAG

Worst-case run time for insert in a hash table using linear probing

O(n)

Average-case run time for contains/find in a binary search tree

O(log n)

Worst-case run time for insert in a binary search tree

O(n)

Worst-case run time for clone or makeEmpty (both are traversals) in a binary search tree

O(n)

This STL container class supports random access with an index, and can grow/shrink at either end

deque

This STL container class lets you efficiently insert, find, and remove items based on their value, not position, and requires them to be comparable using operator<

set

An algorithm for finding minimu spanning trees is named after him

Kruskal

An algorithm for finding optimal prefix codes is named after him

Huffman

This graph representation allows the presence or absence of an edge to be checked in constant time

Adjacency Matrix

This graph representation is space-efficient for sparse graphs

Adjacency Lists

A node with no children in a tree

Leaf

The number of items in a hash table divided by the table size

load factor

A function that converts a key value into an array index

hash

Worst-case run time for find in an AVL tree

O(log n)

Average-case run time for insert in a hash table

O(1)

Worst-case run time for insert in a hash table

O(n)

Worst-case run time for find in an STL set

O(log n)

Worst-case run time for insert in a binary search tree

O(n)

This STL container class always stores key-value pairs ordered by key

map

This STL container class can store any type for which an ordering (e.g., operator<) is defined and traverse the container in sorted order using an iterator

set

This STL container class can use a string like an array index (with [ ]) for retrieving a value

map

The minimum number of items a leaf node of a B-Tree of order 7 can store

4

λ should be approximately equal to this for separate chaining

1

λ should definately be less than or equal to this with quadratic probing

.5

This phenomenon makes linear probing take longer than random probing as λ increases

primary clustering

This collision resolution strategy uses a second hash function to probe at intervals that depend on the value being inserted

double hashing

(T/F) For a B-Tree stored on a disk, the maximum number of items stored in a leaf node should be chosen to be as small as possible

False

(T/F) The subtrees of a B-Tree can differ in height, but by no more than 1

False

(T/F) The subtrees of an AVL Tree can differ in height, but by no more than 1

True

(T/F) With collision resolution strategy f(i) = i², insertions can fail if λ = 0.51

True

(T/F) With collision resolution strategy f(i) = i, insertions can fail if λ = 0.95

False

If an algorithm can reduce the size of a problem by a constant factor (e.g. divide it by 2) in constant time, the growth rate of the algorithm is __________

θ(log n)

If the running time of an algorithm increases by a factor of 8 whenever the size of the input increases by a factor of 2, the growth rate of the algorithm is ___________

O(n³)

If an array is nearly sorted, the best sorting algorithm to use is _____________

Insertion Sort

The fastest sort using C++ on a large, randomly-ordered array (taking into account both growth rate and constant factors) is ______________

Quicksort

What is the average-case growth rate for Shellsort using Hibbard's increments?

θ(n⁵/⁴)

If you wanted a non-recursive sort with


O(n log n) worst-case running time, which one would you use?

Heapsort

(T/F) The insert operation takes O(log n) worst-case but only constant time on average in a heap.

True

The main advantage of more sophisticated (than a heap) priority queue implementations like binomial queues and fibonnacci heaps is that they support the ____________ operation efficiently (less than linear time).

meld

A tight, worst-case Big-Oh time bound for the buildHeap operation is ____________

θ(n)

What is the worst-case running time of Quicksort? Is there a simple ordering of the data that could cause this worst case, using the book's implementation of Quicksort?

θ(n²), No

Write the line of code you'd need at the top of your source code file to use STL template functions e.g., sort

#include <algorithm>

A function object (a.k.a functor) is an instance of a struct or class that must define which member function?

operator()

Which STL class lets you store key-value pairs using primitive types or strings as keys in a hash table without needing to define a structured type or your own hash function.

unordered_map

If T(n) is Big-Oh of n² but not Big-Theta of n², what can we conclude?

T(n) = o(n²)

Give the formal definition of Big-Oh, i.e., what does T(n) = O(f(n)) mean precisely?

T(n) = O(f(n)) if there exists a constant c & another n₀ that when used with T(n) allows f(n) to be an upper bound for all n ≥ n₀.


i.e. T(n) ≤ c ∗ f(n)