Path: news.mathworks.com!not-for-mail
From: "Evren " <evrenbrs@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: sorting algorithm
Date: Wed, 3 Dec 2008 16:18:02 +0000 (UTC)
Organization: YTU
Lines: 27
Message-ID: <gh6bfq$6b6$1@fred.mathworks.com>
References: <gh69ni$6gv$1@fred.mathworks.com> <gh6aa9$g95$1@fred.mathworks.com> <gh6alh$lvv$1@fred.mathworks.com> <gh6b1b$s8t$1@fred.mathworks.com>
Reply-To: "Evren " <evrenbrs@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228321082 6502 172.30.248.37 (3 Dec 2008 16:18:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Dec 2008 16:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1626124
Xref: news.mathworks.com comp.soft-sys.matlab:504722


"John D'Errico" <woodchips@rochester.rr.com> wrote in message <gh6b1b$s8t$1@fred.mathworks.com>...
> "Evren " <evrenbrs@gmail.com> wrote in message <gh6alh$lvv$1@fred.mathworks.com>...
> 
> > > > I tried for hours and just can't seem to get it and its do tomorrow. If anyone can help, thank you very much. 
> > > > 
> > > > Here is what I got so far with some help, but it still doesn't work.
> > > > 
> > > > for i=1:(n-1)  % n is the length of the vector V 
> > > >             if V(i)>V(i+1) 
> > > >                     s = V(i); V(i) = V(i+1); V(i+1) = s; 
> > > >             end 
> > > > end
> > > 
> > > "develop your own sorting algorithm".  Why??
> > > 
> > > Sure you could research classical sorting methods and then implement one in Matlab, but what's the point?  Are you expected to dream up a wholly new scheme?
> > 
> > thats what i am expected to do.i must develop my sorting code.can you help me with this.what is the wrong with my code?
> 
> While this will work for two numbers, what happens when
> you have 3 numbers? I.e., what if you use your code to
> sort the numbers [3 2 1]? Try it. Are they in order? Why
> did it fail? Look (carefully) at what it did.
> 
> John

i am trying to understand why it doesnt work but i cant figuger it out.what is the wrong?what can i do to work the code  for more than 5 numbers. i cant solve what to do..i even couldnt work the code yet...