1/135
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is the correct asymptotic relationship between 2^n and n^100? and what are the steps to answering
2^n = Ω(n^100)
Ω A grows faster than or equal to B
O A grows slower than or equal to B
Θ A grows at the same rate as B
Using the Master Theorem, what is the solution to T(n) = 4T(n/2) + 7n^(8/5)? and how?
Θ(n^2)
aT(n/b)
f(n) = 7n^(8/5) = n^8/5
n^[logb (a)]
compare n^[logb (a)] with f(n) biggest wins
Using the Master Theorem, what is the solution to T(n) = 2T(n/2) + n?
Θ(n log n)
if f(n) and logb (a) are the same it becomes xlogn x = logb (a)
How many subproblems does Strassen’s matrix multiplication reduce n×n multiplication into?
7
What is the expected number of rolls until a fair 6-sided die shows a 6?
6
If a ball numbered 1–100 is chosen uniformly at random, what is the probability that 7 ≤ n ≤ 16?
1/10
What is the expected running time of randomized Quicksort?
O(n log n)
What property must a max heap satisfy?
Every parent node is greater than or equal to its children
time complexity merge sort
nlogn
Heap week 4
Time complexity of insertItem
logn
Heap week 4
Time complexity of remove max
logn
Time complexity of heap sort
nlogn
Time complexity of counting sort
O(n + k)
Time complexity of radix sort
O(d * n)
how does radix sort work
132 315 827 469 507 193 657 274
order the numbers by smallest digit first
132 193 274 315 827 507 657 469
Then the next largest digits
expected length in a randomised quick sort
2 log4/3 n
Time complexity of the knapsack problem
O(nW )
Time complexity of repeating squares (fibonacci)
O(log n)
The time complexity of the fractional knapsack problem
O(nlog(n))
time complexity of interval scheduling
O(n log n)
What is does an undirect graph look like

2 vertices connected by an edge

An edge connected to a specific vertex

Sum of deg(v) = 2m.




What is a connected graph

Contains all vertices of the original graph
graph must be connected
graph must have no cycles
For an undirected graph with n vertices and m edges, what are the upper bounds for connected, tree, and forest?
what does an adjacency list look like

Explain DFS
Visit a neighbour
Keep going deeper
Backtrack when stuck

Given a fixed source vertex v, find the minimum-weight path from v to every other vertex u in the graph.
A-B
A-C
A-D
w(P) = sum of w(ei) for i = 1 to k.
What is the Bellman-Ford algorithm's time complexity?
O(|V| x |E|).
Time complexity APSP using Bellman-Ford
Time: O(|V|^2 x |E|) potentially O(|V|^4).
Time complexity Floyd-Warshall algorithm for APSP?
Solves APSP in O(n^3) using dynamic programming
what is a directed walk

what does an adjaceny matrix look like

Explain bfs
Visit all immediate neighbours
Then neighbours of those neighbours
Continue outward

Time complexity of DFS and BFS
O( V + E) V = vertices, E = edges
It means you can start at a vertex, follow the arrows on the edges, and eventually return to the starting vertex without ever going against an arrow.
O(m).
Time complexity of Ford-Fulkerson networks
a graph where the vertices can be split into two separate sets so that:
every edge goes between the two sets
no edge connects two vertices in the same set
each vertex can appear in at most one selected edge
2 vertices cannot share the same endpoint
Complexity of maximum bipartite matching using flow Ford-Fulkerson
O(nm) .
strassen algorithm time complexity

what is the formula for Strassen matrix T(n)

By frequency analysis
A system with encryption function E (public) and decryption function D (private) satisfying: D(E(M)) = M
A public-key encryption method. Its security is based on the difficulty of factoring large numbers.
What are the RSA key generation steps? 4
Choose two large distinct primes p and q. Set n = p·q and (Euler's Totient)φ(n) = (p−1)(q−1). Choose e (a prime number) with 1 < e < φ(n) and gcd(e, φ(n)) = 1. Find d such that ed ≡ 1 (mod φ(n)). Public key: (e, n). Private key: d.
C = M^e mod n, where M is the plaintext message, e and n are the public key.
M = C^d mod n, where C is the ciphertext and d is the private key.
sender computes signature S = M^d mod n using his private key d. receiver verifies by checking M ≡ S^e (mod n) using Bob's public key e.
O(log(max{a, b}))
time complexity of fast (repeated squaring) exponentiation?
O(log k)
O(log n)
A computational problem whose answer is either 'yes' or 'no'.
Add a parameter k and ask whether the objective value is at most (or at least) k.
The set of all decision problems solvable in worst-case polynomial time.
complexity is O(n^k)