#### Study sets matching "algorithms"

#### Study sets matching "algorithms"

Linked List

Stack

Queue

Binary Tree

Head & Tail. Single linked looks forward only. Doubly linked…

LiFo (Last in, first out). Items are "pushed" onto the stack…

FiFo(First in, First out). Items are "enqueue" into queue and…

Root (or Head node) = Very top node... Leaf nodes/Terminal nodes…

Linked List

Head & Tail. Single linked looks forward only. Doubly linked…

Stack

LiFo (Last in, first out). Items are "pushed" onto the stack…

Selection sort

Binary search

Sequential search

Bubble sort

For all but last element traverse to get largest element... plac…

For sorted element set... Divide in half... Compare if term is grea…

Loop through sorted set until item found

Traverse set... Swap adjacent items if out of order... Repeat until…

Selection sort

For all but last element traverse to get largest element... plac…

Binary search

For sorted element set... Divide in half... Compare if term is grea…

What is an algorithm?

What is asymptotic notation?

Briefly describe and give an example o…

List the 3 methods of resolving recurr…

Series of steps that take inputs and translates them to outpu…

Describes growth. Tells about the runtime of an algorithm.

f(n)=O(g(n)) : g(n) is an upperbound of f(n). ... f(n) = Ω(g(n))…

Master method, substitution, recursion tree.

What is an algorithm?

Series of steps that take inputs and translates them to outpu…

What is asymptotic notation?

Describes growth. Tells about the runtime of an algorithm.

pseudo code

natural language

boolean condition

algorithm

is a kind of structured English for describing algorithms. It…

a language that has developed naturally in use (as contrasted…

compares two values to each other and then returns either a t…

a set of steps; for a computer program to accomplish

pseudo code

is a kind of structured English for describing algorithms. It…

natural language

a language that has developed naturally in use (as contrasted…

%

return

if

r

//complete greatest... //common divisor... public static int gcd(in…

//complete greatest... //common divisor... public static int gcd(in…

//complete greatest... //common divisor... public static int gcd(in…

//complete greatest... //common divisor... public static int gcd(in…

%

//complete greatest... //common divisor... public static int gcd(in…

return

//complete greatest... //common divisor... public static int gcd(in…

Isolate the lowest bit that is 1 in x

Replace the lowest bit that is 1 with 0

Right propagate the rightmost set bit…

Compute x modulo a power of 2 (y)

x & ~(x - 1)

x & (x - 1)

x | (x & ~(x - 1) - 1)

x & (y - 1)

Isolate the lowest bit that is 1 in x

x & ~(x - 1)

Replace the lowest bit that is 1 with 0

x & (x - 1)

Bubble Sort Algorithm

Quick Sort Algorithm

Binary Search Algorithm

Bin Packing Algorithm

1. If there is one number in the list then stop.... 2. Make one…

1. choose the item at mid-point to be first pivot.... 2. write d…

1. Choose the item at midp-point,m.... 2. (i) if T=m then search…

1. Select each item and place in the first available bin than…

Bubble Sort Algorithm

1. If there is one number in the list then stop.... 2. Make one…

Quick Sort Algorithm

1. choose the item at mid-point to be first pivot.... 2. write d…

Heapsort

Quicksort

Mergesort

Binary search

Sort in O(1) space, O(nlgn) time.

Sort in O(nlgn) time average case, or O(n**2) worse case

Sort in O(nlgn) time, O(n) space

Search sorted list in O(lgn) time

Heapsort

Sort in O(1) space, O(nlgn) time.

Quicksort

Sort in O(nlgn) time average case, or O(n**2) worse case

Bubble Sort

Quick Sort

Binary Search

First-Fit

1. Write out the the numbers/names given.... 2. Record only each…

1. Write down the list... 2. Select the pivot(mid point)... 3. Now…

1. Use one of the sorting algorithms (quick sort or bubble so…

1. Take the items in the order given ... 2. Place each item in t…

Bubble Sort

1. Write out the the numbers/names given.... 2. Record only each…

Quick Sort

1. Write down the list... 2. Select the pivot(mid point)... 3. Now…

Selection Sort

Bubble sort

sequential search

string brute force match

Scan array, swap lowest for first. n2 Unstable.

compare adjacent. swap if necessary. biggest floats to the to…

scan through for the key. if found return true. add they key…

align the key against the beginning of the sentence. move thr…

Selection Sort

Scan array, swap lowest for first. n2 Unstable.

Bubble sort

compare adjacent. swap if necessary. biggest floats to the to…

Merge Sort: worst, average, best effic…

Merge Sort: attributes

Merge Sort: explanation of efficiency

Merge Sort: common improvements

O(n log n) b/c it always divides a segment in half at each st…

Stable (equal elements retain their original relationship).... C…

TBD. Note O(n) additional memory is needed

Hybrid: use e.g. InsertionSort when segments get small enough…

Merge Sort: worst, average, best effic…

O(n log n) b/c it always divides a segment in half at each st…

Merge Sort: attributes

Stable (equal elements retain their original relationship).... C…

Quicksort

Mergesort

Heapsort

Insertion Sort

Best: O(n log(n))... Average: O(n log(n))... Worst: O(n^2)

Best: O(n log(n))... Average: O(n log(n))... Worst: O(n log(n))

Best: O(n log(n))... Average: O(n log(n))... Worst: O(n log(n))

Best: O(n)... Average: O(n^2)... Worst: O(n^2)

Quicksort

Best: O(n log(n))... Average: O(n log(n))... Worst: O(n^2)

Mergesort

Best: O(n log(n))... Average: O(n log(n))... Worst: O(n log(n))

algorithm

Euclid's algorithm

sieve of Eratosthenes

floor function

a sequence of unambiguous instructions for solving a... problem,…

gcd(m, n) = gcd(n, m mod n)

The algorithm starts by initializing a list of prime candidat…

round down

algorithm

a sequence of unambiguous instructions for solving a... problem,…

Euclid's algorithm

gcd(m, n) = gcd(n, m mod n)

Algorithm

Input

Output

Instance of the Problem

Well defined computational procedure that takes some input an…

value or values given to an algorithm

value or values produced by an algorithm

particular input

Algorithm

Well defined computational procedure that takes some input an…

Input

value or values given to an algorithm

binary search

binary search pseudocode

running time of binary search

rate of growth

searches an ordered array for a target value by using the mid…

1. Let min = 1 and max = ... n... 2. Guess the average of max and m…

max possible steps =( base-2 logarithm of n) +1... n= length of…

how fast does the running time of the algorithm grow with the…

binary search

searches an ordered array for a target value by using the mid…

binary search pseudocode

1. Let min = 1 and max = ... n... 2. Guess the average of max and m…

collection

linear collection

non-linear collection

Examples of linear collection:... A. obje…

a structured data type that stores data and provides operatio…

a list of elements where one element follows the previous... ele…

hold elements that do not have positional order... within the co…

C

collection

a structured data type that stores data and provides operatio…

linear collection

a list of elements where one element follows the previous... ele…

Gale-Shapley Stable Matchings

Algorithms

What are the properties of Asymptotic…

What are common runtimes for algorithms?

Whichever gender proposes is the one that gets worse and wors…

A set of instructions

Transitivity - if f = O(g) and g = O(h), then f = O(h) (same…

linear: computing the maximum, merging two sorted lists... nlog…

Gale-Shapley Stable Matchings

Whichever gender proposes is the one that gets worse and wors…

Algorithms

A set of instructions

Selection sort

Binary search

Sequential search

Bubble sort

For all but last element traverse to get largest element... plac…

For sorted element set... Divide in half... Compare if term is grea…

Loop through sorted set until item found

Traverse set... Swap adjacent items if out of order... Repeat until…

Selection sort

For all but last element traverse to get largest element... plac…

Binary search

For sorted element set... Divide in half... Compare if term is grea…