Skip to content
Είστε εδώ: Home
Thursday, 22 November 2012 09:33

Matlab code for Bubble Sort Featured

Written by 
  • font size decrease font size decrease font size increase font size increase font size
  • Print
  • Email
  • My Great Web page
  • Be the first to comment!
Rate this item
(2 votes)

 

function S = bubblesort(A)
% Assume A row/column; Copy A to S
S = A;
N = length(S);
for lastcompare=N-1:-1:1
for i=1:lastcompare
   if S(i)>S(i+1)
     tmp = S(i);
     S(i) = S(i+1);
     S(i+1) = tmp;
   end
end
end

 

Read 9599 times
More in this category: « Matlab vectors - arrays

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

 

LOGO-SOFT-MASTER-300x54

Joomla 3.0 Extensions

clickhebutton1

 

 

 

Check Page Rank of your Web site pages instantly:

This page rank checking tool is powered by PRChecker.info service

 
ΤΟ ΑΛΗΘΙΝΟ ΜΥΣΤΙΚΟ