# Study sets matching "algorithms"

Study sets

Classes

Users

Algorithm

Sequence

Selection

Iteration

a step-by-step procedure for solving problems

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 until there is a required outcome

Algorithm

a step-by-step procedure for solving problems

Sequence

the order in which tasks are to be carried out

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 w…

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

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

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 w…

Linked List

Stack

Queue

Binary Tree

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

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

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 l…

Stack

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

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 p…

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

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 p…

Quick Sort Algorithm

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

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 tr…

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…

Searching Algorithms

Sorting Algorithms

String Manipulation

Iteration

A search algorithm is the step-by-step procedure used to locat…

In computer science a sorting algorithm is an algorithm that p…

Most programming languages that have a string datatype will ha…

In computational mathematics, an iterative method is a mathema…

Searching Algorithms

A search algorithm is the step-by-step procedure used to locat…

Sorting Algorithms

In computer science a sorting algorithm is an algorithm that p…

Isolate the lowest bit that is 1 in x

Replace the lowest bit that is 1 with 0

Right propagate the rightmost set bit i…

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)

Isolate the lowest bit that is 1 in x

Replace the lowest bit that is 1 with 0

Right propagate the rightmost set bit i…

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)

%

return

if

r

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

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

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

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

%

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

return

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

What is an algorithm?

What is asymptotic notation?

Briefly describe and give an example of…

List the 3 methods of resolving recurre…

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

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 output…

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... place…

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

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... place…

Binary search

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

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 top…

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

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

Selection Sort

Scan array, swap lowest for first. n2 Unstable.

Bubble sort

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

Algorithm

Input

Output

Instance of the Problem

Well defined computational procedure that takes some input and…

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 and…

Input

value or values given to an algorithm

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 candidate…

round down

algorithm

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

Euclid's algorithm

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

Big-O Notation

Theta Notation

Omega Notation

Linear

What is the measurement for worst case algorithm performance?

What is the measurement for when worst case and best case are…

What is the measurement for best case algorithm performance?

What is O(n) better known as?

Big-O Notation

What is the measurement for worst case algorithm performance?

Theta Notation

What is the measurement for when worst case and best case are…

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 sequ…

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

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

Loop Invariant

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

problem instance

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

Isolate the lowest bit that is 1 in x

Replace the lowest bit that is 1 with 0

Right propagate the rightmost set bit i…

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

Decomposition

Abstraction

Iteration

A set of instructions for completing a single task

Breaking a large problem down into smaller problems

Simplifying a complex problem

Looping through a set of instructions

Algorithm

A set of instructions for completing a single task

Decomposition

Breaking a large problem down into smaller problems