xiaoy的个人博客分享 http://blog.sciencenet.cn/u/xiaoy

博文

按标题搜索
[用MATLAB写算法]之排序算法2)归并排序merge sort
2017-3-29 18:28
归并排序(merge sort)是一种利用分治策略(divide and conquer)进行排序的算法,算法复杂度为 . filename: merge_sort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function result=merge_sort(num_array) % result=merge_sort(num_array) ascending % algorithm complexity: theta(n*log2(n)) N=len ...
个人分类: 算法学习|7096 次阅读|没有评论
[用MATLAB写算法]之排序算法1)插入排序
2017-3-13 13:09
简单的插入排序,算法复杂度为Θ(n 2 ). filename: insertion_sort %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function sorted_array=insertion_sort(num_array) % sorted_array=insertion_sort(num_array) ascending % algorithm complexity: theta(n^2) for i=2:length(num_array) for j=1: ...
个人分类: 算法学习|6227 次阅读|没有评论

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-23 21:20

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部