Hi, Thanks for the explanation . Somehow , i think , a little change in indentation needed. Bcz, its not working for all the elements. so we have to change the index like i have shown below. def selectionsort(arr): n = len(arr) for i in range(n-1): mini = i for j in range(i+1,n): #
Sir there is a mistake in pass 2, at 07:59 mini = 2 so after swapping in 09:07 when we will compare 42 we will compare it with 41 because mini = 2 and arr1[mini] = 41
sir iss video ko agar aap edit ya delete kar denge to bahut achha hoga kyunki isme error hai jisko aur bhi logo ne point out kiya hai aur jo pahli bar dekhenge wo samjhenge ki likha hua code hi sahi hai isliye please take a proper action..... swapping second loop complete hone ke baad ki jayegi...
Hey, The line which you use for swapping will inside the first loop only as it's inside the second loop it could give wrong answer when there is a bigger array
yup bro, the code is wrong. because of this video i waste my 2 hours, why i cant understand the logic and then after i realise the code is wrong so shameful teacher
Hi, Thanks for the explanation . Somehow , i think , a little change in indentation needed. Bcz, its not working for all the elements. so we have to change the index like i have shown below.
def selectionsort(arr):
n = len(arr)
for i in range(n-1):
mini = i
for j in range(i+1,n): #
I've attended multiple classes but ur simplicity is osam
I appreciate you taking the time to explain that. Thank you.
Great explanation sir
Sir there is a mistake in pass 2, at 07:59 mini = 2 so after swapping in 09:07 when we will compare 42 we will compare it with 41 because mini = 2 and arr1[mini] = 41
bhai code hi galat likha hai sir ne
sir iss video ko agar aap edit ya delete kar denge to bahut achha hoga kyunki isme error hai jisko aur bhi logo ne point out kiya hai aur jo pahli bar dekhenge wo samjhenge ki likha hua code hi sahi hai isliye please take a proper action.....
swapping second loop complete hone ke baad ki jayegi...
correct
Sir ye swapping j loop ke bhar m hogi
Yes bro you are right
Thank you so much sir 🙏❤️
Hey,
The line which you use for swapping will inside the first loop only as it's inside the second loop it could give wrong answer when there is a bigger array
yup bro, the code is wrong. because of this video i waste my 2 hours, why i cant understand the logic and then after i realise the code is wrong so shameful teacher
where the increment code of j exists in program?
In python the by default increment value is 1 so you can omit that part if you want to increase by 1.
There is a typing mistake in line no 8.
The swapping must be done in the same indentation of the second for loop.
Hope everyone evaluates correctly.
Thankuuu sir❤
You consider n=5 but you run Nested For loop of j just 4 times why?
Sir baaki sorting program b karwa do ... pgt k exam se phle
Sir heap sort b krado plz
This code is not working for more than 5 elements.Could u help sir 🙏
swapping wali 8th line inner loop se hata kar outer loop me laado, code me mistake h sir k
Thanks sir
This program is not giving proper output for some arrays
it should be arr[j]
Mini= I likha hain dekho
The 1st comment in Sir's video ❤️
Sir baki bi kerwa dijiye