Insertion sort P41412


Statement
 

pdf   zip   main.cc   main.c   main.java   main.py

thehtml

Write a procedure that sorts v in non-decreasing order using the insertion sort algorithm.

Interface

C++
void insertion_sort(vector<double>& v);
C
void insertion_sort(int n, double v[n]);
Java
public static void insertionSort(double[] v);
Python
insertion_sort(v) # returns None
MyPy
insertion_sort(v: list[float]) -> None

Observation You only need to submit the required procedure; your main program will be ignored.

Information
Author
Jordi Petit
Language
English
Translator
Carlos Molina
Original language
Catalan
Other languages
Catalan
Official solutions
C C++ Java Python
User solutions
C C++ Java Python