SnokenKeekaGuard@lemmy.dbzer0.com to Lemmy Shitpost@lemmy.world · 5 months agoIt do be like thatlemmy.dbzer0.comimagemessage-square10fedilinkarrow-up1355arrow-down17
arrow-up1348arrow-down1imageIt do be like thatlemmy.dbzer0.comSnokenKeekaGuard@lemmy.dbzer0.com to Lemmy Shitpost@lemmy.world · 5 months agomessage-square10fedilink
minus-squareToes♀linkfedilinkarrow-up19·edit-25 months agoLet me help you sort things out def bubbleSort(arr): n = len(arr) for i in range(n-1): for j in range(0, n-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] #https://www.sortvisualizer.com/bubblesort/
minus-squareNorthWestWind@lemmy.worldlinkfedilinkarrow-up3·5 months agoThey asked for sorting things into categories. Bucket sort is more suitable.
Let me help you sort things out
def bubbleSort(arr): n = len(arr) for i in range(n-1): for j in range(0, n-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] #https://www.sortvisualizer.com/bubblesort/
They asked for sorting things into categories. Bucket sort is more suitable.