Link : https://www.geeksforgeeks.org/place-k-knights-such-that-they-do-not-attack-each-other/
Is the complexity of the above algorithm O( n.m.k) ?
Link : https://www.geeksforgeeks.org/place-k-knights-such-that-they-do-not-attack-each-other/
Is the complexity of the above algorithm O( n.m.k) ?
Yes @f2016115,
The complexity of outer for loop is O(m),
The complexity of inner loop is O(n), and
The complexity of recurrsive call is coming out to be O(k) using Master’s Theorem for subtraction.
Thus, multiplying all three:
Total time complexity is O(n.m.k)
Hope, you are satisfied.
Give a like, if you are satisfied.
Mark it as resolved, if your doubt has been solved.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.