def insertionSort(array): for step in range(1, len(array)): key = array[step] j = step - 1
# Compare key with each element on the left of it until an element smaller than it is found # For descending order, change keyarray[j]. while j >= 0 and key < array[j]: array[j + 1] = array[j] j = j - 1
# Place key at after the element just smaller than it. array[j + 1] = key
Amazingly clear and concise video! Thank you, this helped a lot in my DSA class.
Wow, the animation is great! Did you use the 3b1b library to make this?
def insertionSort(array):
for step in range(1, len(array)):
key = array[step]
j = step - 1
# Compare key with each element on the left of it until an element smaller than it is found
# For descending order, change keyarray[j].
while j >= 0 and key < array[j]:
array[j + 1] = array[j]
j = j - 1
# Place key at after the element just smaller than it.
array[j + 1] = key
Que animación tan buena!
This animation is really good! did you created this using Manim?
is this ASMR
Very helpful!
So satisfying 👍
thank you so much
for an array A, of size N and containing N elements:
for int i from 1 to N-1
int j = i
while j > 0 && a[j] < a[j-1]
swap(a[j], a[j-1])
j--