You are viewing a single comment's thread. Return to all comments →
@anandsingh9123 @shgpt14 This is O(n^2). E.g. 4 2 3 1 In the while loop: when i = 0 t will go from 0 to n-1, since a[n-1] = i+1 = 1
E.g. 4 2 3 1 In the while loop: when i = 0 t will go from 0 to n-1, since a[n-1] = i+1 = 1
Minimum Swaps 2
You are viewing a single comment's thread. Return to all comments →
@anandsingh9123 @shgpt14
This is O(n^2).
E.g. 4 2 3 1
In the while loop:
when i = 0
t will go from 0 to n-1, since a[n-1] = i+1 = 1