Mapa mental
Bubble sort
Contenido del mapa
Bubble sort
what is iteration here
- no of times outer for loop executes
time comp
- worst case O(n^2)
- best case O(n)
- average case O(n^2)
algorithm
- improved
- if no of swaps in any iteration is 0, then stop as it is sorted
- repeatedly swap two adjacent elements if they are in wrong order
- improved
we have to do n-1 iterations before we get sorted array
- 1st iteration - n-1 steps, 2nd iteration - n-2 steps and so on. for i th iteration check up to n-i
iterative and recursive both approach
space complexity O(1)
Información
- Descripción
- Mapa Mental sobre Bubble sort, creado por abhay jagetiya el 25/06/2021.
- Creado por
- abhay jagetiya
- Visitas
- 0
- Valoración