DAT/305: Data Structures For Problem Solving

Ace your homework & exams now with Quizwiz!

bucket

a collection of integer values that all share a particular digit value.

Hash table

a data structure that stores unordered items by mapping (or hashing) each item to a location in an array.

Radix sort

a sorting algorithm designed specifically for integers. The algorithm makes use of a concept called buckets and is a type of bucket sort.

O(N log N) has a _____ runtime complexity.

linear-arithmetic

Θ notation

provides a growth rate that is both an upper and lower bound.

O(N + N2) has a _____ runtime complexity.

quadratic

computational problem

specifies an input, a question about the input that can be answered using a computer, and the desired output.

Asymptotic notation

the classification of runtime complexity that uses functions that indicate only the growth rate of a bounding function

Record

the data structure that stores sub-items, often called fields, with a name associated with each sub-item.

auxiliary space complexity

the space complexity not including the input data

base case

A case where a recursive algorithm completes without applying itself to a smaller sub-problem.

Lower bound

A function f(N) that is ≤ the best case (runtime complexity) T(N), for all values of N ≥ 1.

Upper bound

A function f(N) that is ≥ the worst case (runtime complexity) T(N), for all values of N ≥ 1

A linear search has a _____ runtime complexity.

O(N)

A selection sort has a _____ runtime complexity.

O(N^2)

Selection sort

a sorting algorithm that treats the input as two parts, a sorted part and an unsorted part, and repeatedly selects the proper next value to move from the unsorted part to the end of the sorted part.

Heap

a tree that maintains the simple property that a node's key is greater than or equal to the node's childrens' keys. A________ is a tree that maintains the simple property that a node's key is less than or equal to the node's childrens' keys.

Set

an ADT for a collection of distinct items.

Dynamic array

an ADT for holding ordered data and allowing indexed access.

Bag

an ADT for storing items in which the order does not matter and duplicate items are allowed.

Queue

an ADT in which items are inserted at the end of the queue and removed from the front of the queue.

Stack

an ADT in which items are only inserted on or removed from the top of a stack.

Deque

an ADT in which items can be inserted and removed at both the front and back

Dictionary

an ADT that associates (or maps) keys with values.

recursive algorithm

an algorithm that breaks the problem into smaller sub-problems and applies the algorithm itself to solve the smaller sub-problems.

Binary search

an efficient algorithm for searching a list. The list's elements must be sorted and directly accessible (such as an array).

constant time operation

an operation that, for a given processor, always operates in the same amount of time, regardless of input values.

NP-complete problems

are a set of problems for which no known efficient algorithm exists. NP-complete problems have the following characteristics: -No efficient algorithm has been found to solve an NP-complete problem. -No one has proven that an efficient algorithm to solve an NP-complete problem is impossible. -If an efficient algorithm exists for one NP-complete problem, then all NP-complete problem can be solved efficiently.

Rules for determining Big O notation of composite functions.

c · O(f(N))=O(f(N)) c + O(f(N))=O(f(N)) g(N) · O(f(N))=O(g(N) · f(N)) g(N) + O(f(N))=O(g(N) + f(N))

pivot

can be any value within the array being sorted, commonly the value of the middle array element.

binary search

checks the middle contact first. If the desired contact comes alphabetically before the middle contact, binary search will then search the first half and otherwise the last half. Each step reduces the contacts that need to be searched by half.

O(5) has a _____ runtime complexity

constant

Longest common sub-string problem

determines the longest common sub-string that exists in two inputs strings.

Dijkstra's shortest path

determines the shortest path from a start vertex to each vertex in a graph.

Priority queue

each item has a priority, and items with higher priority are closer to the front of the queue than items with lower priority.

recurrence relation

operates on half of the input, making the runtime complexity T(N) = O(1) + T(N / 2).

Ω notation

provides a growth rate for an algorithm's lower bound.

O notation

provides a growth rate for an algorithm's upper bound

Quicksort

sorting algorithm that repeatedly partitions the input into low and high parts (each part unsorted), and then recursively sorts each of those parts. To partition the input, quicksort chooses a pivot to divide the data into low and high parts.

List

an ADT for holding ordered data.

Fibonacci number

A term in the Fibonacci sequence.

recursion tree

A useful tool for solving recurrences

data structure

A way of organizing, storing, and performing operations on data. Operations performed on a data structure include accessing or updating stored data, searching for specific data, inserting new data, and removing data.

operations that are generally considered constant time operations

Addition, subtraction, multiplication, and division of fixed size integer or floating point values Assignment of a reference, pointer, or other fixed size data value. Comparison of two fixed size data values. Read or write an array element at a particular index.

Graph

a data structure for representing connections among items, and consists of vertices connected by edges. A vertex represents an item. An edge represents a connection between two vertices.

Binary tree

a data structure in which each node stores data and has up to two children, known as a left child and a right child.

Linked list

a data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node.

Array

a data structure that stores an ordered list of items, where each item is directly accessible by a positional index.

abstract data type

a data type described by predefined user operations, such as "insert data at rear," without indicating how each operation is implemented.

recursive function

a function that calls itself

space complexity

a function, S(N), that represents the number of fixed-size memory units used by the algorithm for an input of size N.

runtime complexity

a function, T(N), that represents the number of constant time operations performed by the algorithm on an input of size N

Big O notation

a mathematical way of describing how a function (running time of an algorithm) generally behaves in relation to the input size. In Big O notation, all functions that have the same growth rate (as determined by the highest order term of the function) are characterized using the same _______________.

Fibonacci sequence

a numerical sequence where each term is the sum of the previous 2 terms in the sequence, except the first 2 terms, which are 0 and 1

gap value

a positive integer representing the distance between elements in an interleaved list. For each interleaved list, if an element is at index i, the next element is at index i + gap value.

Linear search

a search algorithm that starts from the beginning of a list, and checks each element until the search key is found or the end of the list is reached.

algorithm

a sequence of steps to solve a computational problem or perform a calculation.

Merge sort

a sorting algorithm that divides a list into two halves, recursively sorts each half, and then merges the sorted halves to produce a sorted list. The recursive partitioning continues until a list of 1 element is reached, as list of 1 element is already sorted.

Bubble sort

a sorting algorithm that iterates through a list, comparing and swapping adjacent elements if the second element is less than the first element. Bubble sort uses nested loops. Given a list with N elements, the outer i-loop iterates N times. Each iteration moves the ith largest element into sorted position. The inner j-loop iterates through all adjacent pairs, comparing and swapping adjacent elements as needed, except for the last i pairs that are already in the correct position,.

Shell sort

a sorting algorithm that treats the input as a collection of interleaved lists, and sorts each list individually with a variant of the insertion sort algorithm. Shell sort uses gap values to determine the number of interleaved lists.

Insertion sort

a sorting algorithm that treats the input as two parts, a sorted part and an unsorted part, and repeatedly inserts the next value from the unsorted part into the correct location in the sorted part.

Computational complexity

the amount of resources used by the algorithm. The most common resources considered are the runtime and memory usage.

Sorting

the process of converting a list of elements into ascending (or descending) order.

worst-case runtime

the runtime complexity for an input that results in the longest execution.

An algorithm's "worst case"

the scenario where the algorithm does the maximum possible number of operations.

An algorithm's "best case"

the scenario where the algorithm does the minimum possible number of operations.

runtime

the time the algorithm takes to execute

The partitioning algorithm

uses two index variables l and h (low and high), initialized to the left and right sides of the current elements being sorted. As long as the value at index l is less than the pivot value, the algorithm increments l, because the element should remain in the low partition. Likewise, as long as the value at index h is greater than the pivot value, the algorithm decrements h, because the element should remain in the high partition. Then, if l >= h, all elements have been partitioned, and the partitioning algorithm returns h, which is the index of the last element in the low partition. Otherwise, the elements at indices l and h are swapped to move those elements to the correct partitions. The algorithm then increments l, decrements h, and repeats.


Related study sets

Project Management Chapter 11 Final

View Set

MRM 301 - ch 8 (bacterial genetics)

View Set