Insertion Sort MatLab Function
You can simply copy and paste this function to the folder you keep your function m-files.
Insertion Sort is of n^2 order and performs well for up to 10,000 inputs.
Examples of how you can use this function include, but aren't limited to:
1.
plot(floor(100 * rand(1,100))); hold on;
plot(insertion_sort(floor(100 * rand(1,100))),'r');
2.
a = insertion_sort([1 2 3 2 1 2 3 5 4 3 2 1 4 6 8])
I would appreciate your suggestions, further examples, comments and criticisms.
Best Regards
Mehdi
Cite As
Mehdi Goudarzi (2024). Insertion Sort MatLab Function (https://www.mathworks.com/matlabcentral/fileexchange/39528-insertion-sort-matlab-function), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |