I coded sorting What I'm curious about is
This part. Temp refers to alist[i] and alist[i] refers to alist[list] and finally, The alist[last] refers to the temp, so the three values are thought to be the same, but the result is The temp=alist[i] element is stored and does not change... Why is that?
python
I think you've implemented a swap. I think you can think of it easily.
temp alist[i] alist[least]
------------------------------------
alist[i] alist[i] alist[least] <- temp = alist[i]
alist[i] alist[least] alist[least] <- alist[i] = alist[least]
alist[i] alist[least] alist[i] <- alist[least] = temp
So alist[i] and alist[list] are going to change.
© 2024 OneMinuteCode. All rights reserved.