> Though I have reservations about recursion depth capacity.

I thought the purpose is to model the process?
If recursion depth or in general efficiency is an issue 
you shouldn't be using bubblesort.



----- Original Message -----
From: Oleg Kobchenko <[EMAIL PROTECTED]>
Date: Monday, April 28, 2008 10:13
Subject: Re: [Jprogramming] Bubble sort
To: Programming forum <[email protected]>

> bsort very nicely combines some ideas I was
> also considering. Here's just another rending of bsort:
> 
> NB. select mins, recurse complement while not empty.
> 
>    ((#~ , ($:@#~ -.)) (= <./)) ^: (1<#) C
> 0 0 2 4 4 5 6 7 9 9
> 
> Though I have reservations about recursion depth capacity.
> 
> 
> --- On Mon, 4/28/08, Roger Hui <[EMAIL PROTECTED]> wrote:
> 
> > bsort=: ] ` ((=<./) (# , [: $: [EMAIL PROTECTED] # ]) ]) @. (1<#)
> > 
> 
> 
> --- On Mon, 4/28/08, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
> 
> > Here are a couple of closer shots:
> > 
> > NB. recurse the above on tail while not empty
> >    ({. , $:@}.)@(((,~`,@.< [EMAIL PROTECTED]) , 
> [EMAIL PROTECTED])/)^:(1<#) C
> > 0 0 2 4 4 5 6 7 9 9
> >    
> > NB. successively move mins from {: to {.
> >    >{.(( ,&.>&{. , {:@]) ((#~ ; (#~ -.)) (= 
> <./))@>@{:)^:_ '';C
> > 0 0 2 4 4 5 6 7 9 9
> 
> > ----- Original Message -----
> > From: Oleg Kobchenko <[EMAIL PROTECTED]>
> > Date: Sunday, April 27, 2008 23:26
> > Subject: [Jprogramming] Bubble sort
> > To: Programming forum <[email protected]>
> > 
> > > I wanted to model bubble sort.
> > > Here's a first shot. Any improvements?
> > > 
> > >    ]C=. 10 [EMAIL PROTECTED] 10
> > > 6 5 9 2 4 9 0 7 0 4
> > >    /:~ C
> > > 0 0 2 4 4 5 6 7 9 9
> > >    <./ C
> > > 0
> > >    (([ ,`(,~)@.> [EMAIL PROTECTED]) , [EMAIL PROTECTED])/ C
> > > 0 6 5 9 2 4 9 0 7 4
> > >    (([ ,`(,~)@.> [EMAIL PROTECTED]) , [EMAIL PROTECTED])/^:_ C
> > > 0 0 2 4 4 5 6 7 9 9
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to