Advertisements I have this exercise and the goal is to solve it with complexity less than O(n^2). You have an array with length N filled with event probabilities. Create another array in which for each element i calculate the probability of all event to happen until the position i. I have coded this O(n^2) solution.… Read More How can I reduce time complexity on this algorithm?
Advertisements When I am about to know some algorithms I confused about what exacly is input size. For example in travelling sales person problem dynamic programming implementation takes O(2n × n2) And krushals algorithm takes O(E log V).Though both are graph problems why TSP input size is no.of Vertices n and krushals input size is… Read More What exactly is Input size
Advertisements I have just learnt Big-Oh notation and saw the below problem: (1) Is T(n) = 10n^4 + 850n = O(n^3) ?? (2) Is T(n) = 10n^4 + 850n = O(n^4) ?? (3) Is T(n) = 10n^4 + 850n = O(n^30) ?? I have understood (1) that Big-Oh represents the upper bound and hence it… Read More Big Oh notation higher than T(n)