CSC 225 Midterm 1 Flashcards

1
Q

What is a permutation?

A

Number of possible linear combinations where we count all different orderings of elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Permutation Formula

A

n!/(n-r)!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a combination?

A

Number of possible linear combinations where we dont count separate orderings of elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Combination Formula

A

n!/[k!(n-k)!]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Binomial Formula

A

Formula:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the Pigeonhole Principle

A

If m pigeons occupy n pigeonholes then and m > n, then at least 1 pigeonhole has 2 pigeons in it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

simplify

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

simplify

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

simplify

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

simplify

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

memorize logarithm bullshit

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Formal Definition of Big - Oh

A

let f: N+ -> R and g: N+ -> R

f(n) is O(g(n)) IFF there exists a constant c > 0 and n_o > 0 such that

f(n) <= c g(n) for all n > n_o

[f(n) curve must fit under cg(n) curve]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Stirlings Formula?

(approx for n!)

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does a stack work?

A

Stacks follow a LIFO principle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What methods does stack have

A

push

pop

isEmpty

top

size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Worst case and Best case time of selection sort

A

O(n^2), O(n^2)

17
Q

Worst Case / Best Case Insertion Sort

A

O(n^2), O(n)

18
Q

Worst Case / Best Case Bubble Sort

A

O(n^2), O(n)

19
Q

Worst Case / Best Case Quicksort

A

O(n^2), O(nlogn)

20
Q

Worst Case / Best Case Heap Sort

A

O(nlogn), O(nlogn)

21
Q

Worst Case / Best Case Merge Sort

A

O(nlogn), O(nlogn)

22
Q
A