Sorting
Stacks/Queues
Masters Theorem
Time Complexity
C++ Review
100

What method do Merge Sort and Quicksort use to sort?


    A: Divide and Conquer

100

What property does Stack use?

A: FILO /LIFO

100

What are the 3 Cases for Master's Theorem?

    A: Case 1 if a<1

        Case 2 if a=1

        Case 3 if a> 1

100

What symbol/ name do we use for Worst Case?

A: Big O

100

What is Inheritance?

 A: Having a derived class be able to use functions from a superClass.

200

What is the Worst Case for QuickSort?


    A: O(n^2)

200

What property does Queue use ?

A: FIFO/LILO

200

What is the complexity of T(n) = .5T(n-4) + n

A:  n

200

What symbol/ name do we use for Best Case?

A: Big Omega

200

What functions do we typically use in classes?

A: Constructor,Destructor, Setters/getters

300

What is the 3rd pass of Bubble Sort:

Array: [9,2,4,5,12,5 17]

A: [2,4,5,9,5,12,17]

    [2,4,5,5,9,12,17]

    [2,4,5,5,9,12,17]

300

What functions does Queue use?

A:enqueue dequeue, Is empty

300

What is the complexity of T(n) = T(n-6) + n^2

A: n^3

300

What symbol/ name do we use for Average Case?

    A: Big Theta

300

How can we organize class variables/ functions?


A: We can use public,protected and private

400

What is the 3rd pass of Selection sort:

Array: [9,5,32,1,0,35,5]

A  [0,5,32,1,9,5]

    [0,1,32,5,9,5]

    [0,1,5,32,9,5]

400

What functions does Stack use?


    A:push pop top, Is empty

400

What is the complexity of T(n) = 4T(n-1) + n

A: n 4^n



400

What Strategy can we use to solve recurrence relation?

A: Typically we substitute T(n__) until we see a pattern

400


What does a pointer hold?


A: Memory address

500

What is the 3rd pass of Insertion Sort:

 Array: [9,7,6,15,16,5,10,11]

A: [7,9,6,15,5,1610,11]

    [6,7,9,15,5,16,10,11]

    [5,6,7,9,15,16,10,11]

500

If we insert HELLO in a stack and a queue, what will each output?

A: Stack: OLLEH

       Queue:  HELLO

500

What equation do we use for Decreasing  of T(n) = aT(n/b) + f(n) 

(n) = O(nklogpn)

500

FInd the Recurrence Relation:

fun(x){

if(x>0){

for(int i=0;i<x;i++){

cout<< x<<endl;

}

}

func(n-1)

A: T(n-1) + 2n+2 or T(n-1)+n

500

What is the difference between pass by reference and pass by value?

A:in pass by value, values are copied to another variable and terminates after function

        In pass by reference, we pass the memory address of a variable therefore after the function that variable can be changed.

M
e
n
u