How is the complexity of selection sort measured?

How is the complexity of selection sort measured

hello @hiteshbajaj

the outer loop run n times, for each iteration of outer loop the inner loop will execute O(n) in worst case.
which will make the overall time complexity O(N * N)

unclear with the response , explain with an example please

example??

first we have to write the algorithm and then based on that we find the time complexity of algorithm

  • Selection sort algorithm consists of two nested loops.
  • Owing to the two nested loops, it has O(n2) time complexity.

have you write the code for selection sort?

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.