Study sets matching "algorithms"

Study sets
Classes
Users

Study sets matching "algorithms"

40 terms
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.
28 terms
Algorithms
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…
5 terms
Algorithms
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…
57 terms
Algorithms
%
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…
88 terms
Algorithms
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)
10 terms
Algorithms
Build heap upper bound
Heap find max upper bound
Heap increase key upper bound
Heap extract max upper bound
O(n)
O(1)
O(log(n))
O(log(n))
Build heap upper bound
O(n)
Heap find max upper bound
O(1)
14 terms
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…
Algorithms
The heart of any algorithm is an
The primary tool to distinguish correc…
Proof
Idea
...
...
The heart of any algorithm is an
Idea
The primary tool to distinguish correc…
...
17 terms
Algorithms
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…
59 terms
Algorithms
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)
Algorithms
worst case of every comparison based s…
best case of k consecutive AddLasts
worst case of selection sort
average case of selection sort
Ω(n log(n))
Ɵ(k)
quadratic
quadratic
worst case of every comparison based s…
Ω(n log(n))
best case of k consecutive AddLasts
Ɵ(k)
Algorithms
Sort in O(1) space, O(nlgn) time.
Sort in O(nlgn) time average case, or…
Sort in O(nlgn) time, O(n) space
Search sorted list in O(lgn) time
Heapsort
Quicksort
Mergesort
Binary search
Sort in O(1) space, O(nlgn) time.
Heapsort
Sort in O(nlgn) time average case, or…
Quicksort
47 terms
Algorithms
ALERT1
ALERT2
ALERT3
BLDGCOL
1CE... 1CR
2EN... 1CE... 1CR... 1TK... 1RU... 1HZ... 1BC
2EN... 1CE... 1CR... 1TK... 1RU... 1HZ... 1BC
2EN... 1UE... 1TK... 1RU... 1US... 1HZ... 1BC
ALERT1
1CE... 1CR
ALERT2
2EN... 1CE... 1CR... 1TK... 1RU... 1HZ... 1BC
35 terms
Algorithms
f= θ(g)
f=Ο(g)
f= Ω(g)
Divide and conquer
f= O(g) and f= Ω(g)
f(n) <= c*g(n)
g=O(f)
Split problem into smaller instance of same problem... Combine t…
f= θ(g)
f= O(g) and f= Ω(g)
f=Ο(g)
f(n) <= c*g(n)
25 terms
Algorithms
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…
Algorithms
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…
94 terms
Algorithms
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
7 terms
Algorithms
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
13 terms
Algorithms
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
15 terms
Algorithms
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…
16 terms
Algorithms
Advanced Encryption Standard (AES) Alg…
Message Digiest 5 (MD5)
Elliptic Curve Diffie-Hellman Eohemera…
Bowfish
Symmetric Algorithm
Hashing Algorithm
Asymmetric Algorithm`
Symmetric Algorithm
Advanced Encryption Standard (AES) Alg…
Symmetric Algorithm
Message Digiest 5 (MD5)
Hashing Algorithm
Algorithms
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)
5 terms
Algorithms
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
88 terms
Algorithms
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)
11 terms
Algorithms
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…
18 terms
Algorithms
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
Algorithms
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
55 terms
Algorithms
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
Algorithms
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…
61 terms
Algorithms
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
70 terms
Algorithms
Gale-Shapley Runtime
Breadth-first search Runtime
Depth-first search Runtime
Dijkstra's Algorithm Runtime
n^2
m+n ; uses queue
m+n ; uses stack; cannot be used for finding shortest path!
Time: O(|E| |V|log|V|)
Gale-Shapley Runtime
n^2
Breadth-first search Runtime
m+n ; uses queue
algorithms
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)
70 terms
Algorithms
Gale-Shapley Runtime
Breadth-first search Runtime
Depth-first search Runtime
Dijkstra's Algorithm Runtime
n^2
m+n ; uses queue
m+n ; uses stack; cannot be used for finding shortest path!
Time: O(|E| |V|log|V|)
Gale-Shapley Runtime
n^2
Breadth-first search Runtime
m+n ; uses queue
Algorithms
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])…
21 terms
Algorithms
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…
Algorithms
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(…
5 terms
Algorithms
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
14 terms
Algorithms
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…
8 terms
Algorithms
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…
34 terms
ALgorithms
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…
ALgorithms
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…
Algorithms
Breadth-First Search
Depth-First Search
Bellman-Ford
Johnson's Algorithm
O(|V| + |E|)
O(|V| +|E|)
O(|V||E|) V iterations. In each we relax every edge.
O(|V||E|log|V|)
Breadth-First Search
O(|V| + |E|)
Depth-First Search
O(|V| +|E|)
8 terms
Algorithms
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
19 terms
algorithms
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…
7 terms
Algorithms
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…
Algorithms
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
Algorithms
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…
Algorithms
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))
27 terms
Algorithms
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…
17 terms
Algorithms
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…
1 of 10