# Study sets matching "algorithms"

Study sets

Diagrams

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…

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)

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…

%

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…

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)

Linear Search

Binary Search

Recursion

Insertion Sort

A search algorithm that iterates linearly over a collection to…

uses a divide and conquer methodology to find what it's search…

When a function calls on itself.

Moves items from an unsorted collection to a new, sorted colle…

Linear Search

A search algorithm that iterates linearly over a collection to…

Binary Search

uses a divide and conquer methodology to find what it's search…

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…

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…

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

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…

collection

linear collection

non-linear collection

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

a structured data type that stores data and provides operation…

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

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

C

collection

a structured data type that stores data and provides operation…

linear collection

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

INSERTION SORT

SELECTION SORT

QUICKSORT

HEAPSORT

TIME COMPLEXITY: ... BEST: O (n) when list almost sorted... AVERAGE…

TIME COMPLEXITY:... BEST: O(n^2)... AVERAGE: O(n^2)... WORST: O(n^2)…

TIME COMPLEXITY:... BEST: O (n log n), (O(n) three way parition)…

TIME COMPLEXITY:... BEST: O (n log n)... AVERAGE: O (n log n)... WORST:…

INSERTION SORT

TIME COMPLEXITY: ... BEST: O (n) when list almost sorted... AVERAGE…

SELECTION SORT

TIME COMPLEXITY:... BEST: O(n^2)... AVERAGE: O(n^2)... WORST: O(n^2)…

Algorithms

Linear Search

Binary Search

Binary vs Linear

Algorithms are a set of instructions that can be followed to p…

In linear search, the algorithm will methodically search one l…

Binary search works by dividing the list in two each time unti…

Binary is a more efficient algorithm.

Algorithms

Algorithms are a set of instructions that can be followed to p…

Linear Search

In linear search, the algorithm will methodically search one l…

algorithm

linear search algorithm

binary search algorithm

sorting

a finite sequence of precise instructions for performing a com…

linearsearch (x : integer, a₁, a₂, . . . , aᵣ : distinct integ…

binarysearch (x: integer, a₁, a₂, . . . , aᵣ : increasing inte…

putting the elements of a set into a list in which the element…

algorithm

a finite sequence of precise instructions for performing a com…

linear search algorithm

linearsearch (x : integer, a₁, a₂, . . . , aᵣ : distinct integ…