#### Study sets matching "algorithms"

#### Study sets matching "algorithms"

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.

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…

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)

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…

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…

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)

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…

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…

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

what is a equivalence relation?

What is a reflexive relation?

What is a symmetric relation?

What is a transient relation?

a relation between elements of a set that is reflexive, symme…

(a R a), for all a

(a R b) if and only if (b R a)

(a R b) and (b R c) implies (a R c)... Due to transitivity, each…

what is a equivalence relation?

a relation between elements of a set that is reflexive, symme…

What is a reflexive relation?

(a R a), for all a

Algorithm

Sequence

Selection

Iteration

items of data that are next to each other

the order in which tasks are to be carried out

a question is asked, and depending on the answer, the program…

when a task is repeated for a set number of times or until th…

Algorithm

items of data that are next to each other

Sequence

the order in which tasks are to be carried out

What is an Algorithm?

What is a Data Structure?

What is a sorting algorithm?

What is Asymptotic Behavior?

A step-by-step procedure for solving a specific problem.

A method for storing data so that information can be accessed…

...

An abstract analysis of how much faster or slower an algorith…

What is an Algorithm?

A step-by-step procedure for solving a specific problem.

What is a Data Structure?

A method for storing data so that information can be accessed…

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)

Algorithm

Pseudocode

Flow Chart

Process

A set of rules that the computer MUST follow

A method of describing an algorithm in English

A diagram that shows the data flow of a problem and its solut…

A flow chart symbol that represents any process

Algorithm

A set of rules that the computer MUST follow

Pseudocode

A method of describing an algorithm in English

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

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…

Algorithm

Sequence

Sub tasks

Iteration

A step-by-step procedure for solving problems

The order in which tasks are carried out

Small steps making up a larger task

When a task is repeated until there is a required outcome

Algorithm

A step-by-step procedure for solving problems

Sequence

The order in which tasks are carried out

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

Height of node in a heap

Height of heap

Complete tree

Max-heap

Number of edges on the longest simple downward path from the…

Height of its root

Every level, except possibly the last, is completely filled,…

For every node, i, other than the root, A[Parent(i)] >= A[i]…

Height of node in a heap

Number of edges on the longest simple downward path from the…

Height of heap

Height of its root

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…

Stable Matching

Examples of good greedy algorithms

Examples of bad greedy algorithms

Dijkstra's Algorithm

...

Cashier hands back change to customer

Giving stamps to a customer (customer wants fewer stamps)

initialize nodes to infinity... repeatedly choose unexplored nod…

Stable Matching

...

Examples of good greedy algorithms

Cashier hands back change to customer

Pros of Infographics

Basic Rules

Focus Data

Clear Design

-helps people understand complicated info... -tells a story... -new…

compelling data... rich graphics... viral title (eh)

relevant data... reputable sources... fact check... credit sources

limit color palette ... simple graphics... coney message at a glanc…

Pros of Infographics

-helps people understand complicated info... -tells a story... -new…

Basic Rules

compelling data... rich graphics... viral title (eh)

MergeSort and runtime

Mergesort algorithm

Binary Search

DFS + explore

Merge sort... mergesort both halves of the array recursively... unt…

Have an array of n elements... function mergesort (a[1.....n])…

Go to the middle of the array and compare the key with that o…

Explore:... put in the graph G and the vertex v in the method... pr…

MergeSort and runtime

Merge sort... mergesort both halves of the array recursively... unt…

Mergesort algorithm

Have an array of n elements... function mergesort (a[1.....n])…

DES

3DES

AES

Blowfish

Symmetric ; Block cipher ; Block: 64 bits ; Key: 64 bits (56…

Symmetric ; Block cipher ; Block: 64 bits ; Key: 192 bits (16…

Symmetric ; Rjindael Block cipher ; Block: 128 bits ; Key: 12…

Symmetric ; Block cipher ; Block: 64 bits ; Key: variable 32…

DES

Symmetric ; Block cipher ; Block: 64 bits ; Key: 64 bits (56…

3DES

Symmetric ; Block cipher ; Block: 64 bits ; Key: 192 bits (16…

Find Strongly Connected Component

Disjoint Set

Dijkstra's

Prim and Kruskal Algorithms

- A graph is said to be strongly connected if every vertex is…

Union by rank and path compression:... Three functions:... makeSet(…

Finds shortest distances to all nodes... time: O(|E| + |V| log…

finds minimum spanning tree (MST) ... MSTs are spanning trees o…

Find Strongly Connected Component

- A graph is said to be strongly connected if every vertex is…

Disjoint Set

Union by rank and path compression:... Three functions:... makeSet(…

Abstraction

For Loop

While Loop

If Loop

ignoring irrelevant detail so that you can focus on a particu…

will execute a command once for each item in a sequence

will repeatedly execute a command as long as a condition is m…

will execute a command if a condition is met

Abstraction

ignoring irrelevant detail so that you can focus on a particu…

For Loop

will execute a command once for each item in a sequence

Definition of big O

Definition of theta

Definition of omega

logb (b^a) =

f: ∃ c, n0 > 0 ∀n >= n0, 0 < = f(n) < = c*g(n)

f: ∃ c1, c2, n0 > 0 ∀n >= n0, 0 < =c1

**g(n) < = f(n) < = c2**c2*g…f: ∃ c, n0 > 0 ∀n >= n0, 0 < = c*g(n)< = f(n)

a

Definition of big O

f: ∃ c, n0 > 0 ∀n >= n0, 0 < = f(n) < = c*g(n)

Definition of theta

f: ∃ c1, c2, n0 > 0 ∀n >= n0, 0 < =c1

**g(n) < = f(n) < = c2**c2*g…What is an algorithm?

Pseudocode

Iteration

Selection

An algorithm is a step by step procedure for solving problems.

This means 'fake code'... It is a simplified programming code th…

Doing things over and over again

Making decisions

What is an algorithm?

An algorithm is a step by step procedure for solving problems.

Pseudocode

This means 'fake code'... It is a simplified programming code th…

Adjacency matrix:... Checking if (u, v )…

Breadth First Search

Let G be an undirected graph on n node…

what's an undirecte graph

Adjacency matrix and Adjacency list differences... Conclusion:…

BFS intuition: Explore outward from s in all possible directi…

1 G is connected.... 2 G does not contain a cycle.... 3 G has n − 1…

An undirected graph is a tree if it is connected and does not…

Adjacency matrix:... Checking if (u, v )…

Adjacency matrix and Adjacency list differences... Conclusion:…

Breadth First Search

BFS intuition: Explore outward from s in all possible directi…

Adjacency matrix:... Checking if (u, v )…

Breadth First Search

Let G be an undirected graph on n node…

what's an undirecte graph

Adjacency matrix and Adjacency list differences... Conclusion:…

BFS intuition: Explore outward from s in all possible directi…

1 G is connected.... 2 G does not contain a cycle.... 3 G has n − 1…

An undirected graph is a tree if it is connected and does not…

Adjacency matrix:... Checking if (u, v )…

Adjacency matrix and Adjacency list differences... Conclusion:…

Breadth First Search

BFS intuition: Explore outward from s in all possible directi…

Algorithm

Pseudo Code

Flow chart

Linear Search

Step by step process to solve a problem

Resembles a programming language without any syntax

Diagram that represents an algorithm showing the steps as sha…

Starts at one end of data, works through checking each item i…

Algorithm

Step by step process to solve a problem

Pseudo Code

Resembles a programming language without any syntax

community acquired pneumonia (cap) - o…

strep throat dx

Alveolar-arterial gradient (A-a gradie…

pulmonary embolism

CURB-65... confusion... BUN >/= 20... RR >/= 30... SBP <90, DBP <60... age >…

centor criteria... 1. fever... 2. tonsillar exudate ... 3. anterior ce…

normal 5-15 mmHg... A-a = PAo2 - Pao2... PAo2 = [713 mmHg x 21% -…

wells' criteria... 1. sxs of DVT (3 pts)... 2. no other dx more lik…

community acquired pneumonia (cap) - o…

CURB-65... confusion... BUN >/= 20... RR >/= 30... SBP <90, DBP <60... age >…

strep throat dx

centor criteria... 1. fever... 2. tonsillar exudate ... 3. anterior ce…

input

output

definiteness

correctness

An algorithm has input values from a specified set.

From each set of input values, an algorithm produces these va…

The steps of an algorithm must be defined precisely.

An algorithm should produve the correct output values for eac…

input

An algorithm has input values from a specified set.

output

From each set of input values, an algorithm produces these va…

Algorithm

Sequence

Selection

Iteration

items of data that are next to each other

the order in which tasks are to be carried out

a question is asked, and depending on the answer, the program…

when a task is repeated for a set number of times or until th…

Algorithm

items of data that are next to each other

Sequence

the order in which tasks are to be carried out

Bellman-Ford

Kruskal's

Bogo Sort

Insertion Sort

Shortest path that allows negative edge values. For V-1 itera…

Minimum spanning tree. Build using smallest edges and connect…

Randomize array until everything is sorted

Generate a running sorted list. Insert new number where it be…

Bellman-Ford

Shortest path that allows negative edge values. For V-1 itera…

Kruskal's

Minimum spanning tree. Build using smallest edges and connect…

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))

Loop Invariant

problem instance

correctness

Monotonicity

a property/logical assertion that holds before and after each…

the input needed to compute a solution (example: an input seq…

an algorithm is correct if for all input instances, it halts…

- monotonically increasing: m <= n => f(m) <= f(n)... - monotoni…

Loop Invariant

a property/logical assertion that holds before and after each…

problem instance

the input needed to compute a solution (example: an input seq…

Algorithm

Low level programming language

High level programming language

Every algorithm can be constructed usi…

A precise sequence of instructions for processes that can be…

A programming language that captures only the most primitive…

A programming language with many commands and features design…

Sequencing, selection, and iteration

Algorithm

A precise sequence of instructions for processes that can be…

Low level programming language

A programming language that captures only the most primitive…