728x90

Algorithm/Design and Analysis of Algorithms 13

Randomization: Matrix Multiply Checker, Quicksort

Matrix Multiply Checker AB = C takes at least these much time. we want matrix product checker that checks if mutiplication is correct in O(n2). we choose vector r randomly that has only 1 or 0. and we compute A(Br) = (Cr) if it is same than we say it's true otherwise false. this computation takes O(n2) because (n*n) * (n*n) * (n*1) == n^2 , (n*n) * (n*1) == n we want to show that there are many ..

Dijkstra , bellman-ford ,Bi-directional Djikstra

the difference happens how we smartly select edge in the case we Topologically sort the DAG and then select edges in order. since this is dag this works if graph doesn't have cycle and works for negative. in case of dijkstra we pick the edge that has the minimum priority (in this case d[u], the current shortest distance from source). dijkstra works with cycles but all the weight have to be non n..

728x90