Algo Eng - Class 9

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/22

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

23 Terms

1
New cards

Recursive Case

When function calls itself

2
New cards

Base Case

When function doesnt call itself again to prevent an infinite loop

3
New cards

Call Stack

Functions are put onto stack when called, includes recurrsions. Results in stack overflow error if stack is too big

4
New cards

Divide and Conquer

Strategy to divide problem into subproblems (problem is same as subproblem, repetitive structure), find solutions to said subproblems, then combine solutions to get solution to main problem

5
New cards

Decrease-by-one pattern

Each processing step reduces the number of input pieces by exactly 1, so a problem instance with n pieces requires n processing steps

6
New cards

Decrease-by-half pattern

Each processing step reduces the number of input pieces by roughly half, so only about log(n) processing steps are required

7
New cards

DCC Approach

Divide, Conquer, Combine

8
New cards

Recurrence Relation

T(…) for measuring with recurrences

9
New cards

Time Complexity (non-masters)

Ex: Test(n-1) → T(n-1), only take in account for then time complexities with the same block as the recursion call. Starting (top equation) is just 1 n = (whatever if statement condition is, ex: if(n>1) → 1 n = 1)

10
New cards

Minimum Selection Problem Recurrence Relation

2T(n/2) + O(1)

11
New cards

Summation Problem Recurrence Relation

2T(n/2) + O(1)

12
New cards

Master Theorem

knowt flashcard image
13
New cards

Master Theorem Case 1, If f(n) grows slower than n^(logb a)

knowt flashcard image
14
New cards

Master Theorem Case 2, If f(n) is equal to n^(logb a)

knowt flashcard image
15
New cards

Master Theorem Case 3, If f(n) is bigger n^(logb a)

knowt flashcard image
16
New cards

Master Theorem cannot be used if

  1. T(n) is trigonometric

  2. f(n) is not a polynomial

  3. d cannot be expressed as a constant, ex T(n) = T(sqrt(n))

17
New cards

Maximum Sub Problem Recurrence Relation

T(n) = 2T(n/2) + n

18
New cards

Maximum Sub Problem Using Master’s Theorem

T(n) = O(n log n)

19
New cards

Merge Sort Recurrence Relation

T(n) = 2T(n/2) + n + 2

20
New cards

Merge Sort using Master’s Theorem

T(n) = O(n log n)

21
New cards

Merge Sort is a _____ algorithm

Stable Sorting

22
New cards

Stable Sorting Algorithm

When a sorting algorithm has the property that equal items appear in the final sorted list in the same relative order that they appeared in the initial input (i.e. ordering students in first attribute “name” then ordering students by second attribute “grade”, individuals with same grade, remain sorted by name)

23
New cards

Binary Search Recurrence Relation

T(n/2) + 5