When I am initializing min as arr[i] in 1st for loop,why i am getting wrong answer?
Arrays-Selection sort
hey @sonam13065, you are j should start from i+1 instaed of i and swap should be inside the for loop.I have made these changes and indicated in your code https://ide.codingblocks.com/s/167387
Again getting wrong answer.
Thanks.But could you please tell me what was the problem in my code?
hey @sonam13065, in your code min is not updated properly. Please dry run both these code once and you will get the difference
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.