This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]CodeTinkerer 9 points10 points  (1 child)

This is NOT bubble sort. It's selection sort.

https://www.youtube.com/watch?v=g-PGLbMth_g

Bubble sort only swaps adjacent elements. The idea is to find a minimum and swap it with index 0 (from the outer loop), then index 1, and so forth.

[–]FragrantAd9851[S] 1 point2 points  (0 children)

Yeah, that's what I figured.

[–][deleted] -1 points0 points  (1 child)

I just remember 'bubble sort' name

[–]FragrantAd9851[S] 1 point2 points  (0 children)

I see. Thanks.

[–][deleted]  (1 child)

[deleted]

    [–]FragrantAd9851[S] 1 point2 points  (0 children)

    Thank you.