function [ A ] = heapsort( A )
%UNTITLED14 Summary of this function goes here
% Detailed explanation goes here
A=build_max_heap(A);
[m,n]=size(A);
for i=n:-1:2
temp=A(1);
A(1)=A(i);
A(i)=temp;
n=n-1;
A=max_heapify(A,n,1);
end
end
%UNTITLED14 Summary of this function goes here
% Detailed explanation goes here
A=build_max_heap(A);
[m,n]=size(A);
for i=n:-1:2
temp=A(1);
A(1)=A(i);
A(i)=temp;
n=n-1;
A=max_heapify(A,n,1);
end
end
function [ A ] = build_max_heap( A )
%UNTITLED12 Summary of this function goes here
% Detailed explanation goes here
[m,n]=size(A);
for i=floor(n/2):-1:1
A=max_heapify(A,n,i);
end
function [ A ] = max_heapify( A,n,i )
%UNTITLED11 Summary of this function goes here
% Detailed explanation goes here
l=left(i);
r=right(i);
if l<=n&&A(l)>A(i)
largest=l;
else
largest=i;
end
if r<=n&&