matlab插入排序

来源:互联网 发布:欠淘宝贷款2年了没还上 编辑:程序博客网 时间:2024/05/20 00:13
function [ A ] = insertSort( A )
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here
[m,n]=size(A);
    for j=2:n
        temp=A(j);
        i=j-1;
      while i>0&&temp<A(i)
          A(i+1)=A(i);
          i=i-1;
      end
      A(i+1)=temp;
    end


end


0 0
原创粉丝点击