What would be its time complexity?
Time complexity of Nqueen problem
hello @anika203 its time complexity is O(2^n).
if you feel that you still have doubt in anything you can ask .
Happy Learning !!
How is it O(2^n) can you please explain from the code :
the time complexity varies acording to the solutiion the best time complexity can be even better i.e less than N!.
and this because :
average and worst case complexity of the solution is O(N!)O(N!) (since, you are checking all the possible solutions. The best case occurs if you find your solution before exploiting all possible arrangements. This depends on your implementation.
So in the worst case it would be O(N!)?
@anika203a as i said it depends on your implementation but according to your implementation the worst case will be solved in N! only .
Yeah got it thank you!
hey @anika203a if you query is resolved then please mark this doubt as resolves and do give the star rating .
Happy Learning !!