Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ex: python

def insertion_sort(data):
    for i in range(0, len(data)):
        insert_val = data[i]
        hole_pos = i

        while hole_pos > 0 and insert_val < data[hole_pos - 1]:
            data[hole_pos] = data[hole_pos - 1]
            hole_pos = hole_pos - 1

        data[hole_pos] = insert_val
Source by dev.bertzzie.com #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
1+4 =