Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #34283

Re: Improve my sort!

Newsgroups comp.lang.javascript
Date 2017-11-04 13:26 -0700
References <29745427-ec33-4eea-b8ac-e72ef8b416de@googlegroups.com> <6e1799aa-73cd-4ceb-b6bb-c8e0dd04b378@googlegroups.com> <586dd7cc-dbe7-425b-aadb-8177f244bc93@googlegroups.com> <f34550a2-30d4-4d84-a758-f81ad4dddc01@googlegroups.com>
Message-ID <3e760751-4e27-4aec-9bfe-57139be7f7f9@googlegroups.com> (permalink)
Subject Re: Improve my sort!
From jonas.thornvall@gmail.com

Show all headers | View raw


Den lördag 4 november 2017 kl. 20:40:25 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> > Michael Haufe (TNO):
> > > jonas.t...@gmail.com wrote:
> > > > [...]
> > > 
> > > Fix all of the errors described at <http://jshint.com/>
> > 
> > As long the code is fast and have correct output i am happy. Fix the errors yourself if you like for me it works.
> 
> Thanks, but I think I'll avoid adding 'subjective sort' to my list of useful algorithms.

Sure you can't have problem understand the algorithm

function jtindexsort(){ 
var starttime = new Date().getTime();
countval= new Array(); 
//Initiate array range
for (j=start;j<end;j++){ 
countval[j]=0; 
} 
var temp;

//Put them on correct index
for (var i=0;i<numberofvalues;i++){ 
  temp=dval[i]; 
  countval[temp]=countval[temp]+1; 
} 
p=0;



offset=0; 
for (var i=start;i<end;i++){ 
dval.fill(i,offset,offset+countval[i]); 
offset=offset+countval[i]; 
} 

var endtime = new Date().getTime();
var timed = endtime - starttime;
document.sort.functime.value=timed;
}

If you think that ones to hard to analyse for your febble mind try the one below, it easy enough to teach a ten year old. Or to be created by a ten year old.

So tell me what is it you object to?

function jtindexsort(){ 
//Initiate array range
q=0; 
countval.fill(q,start,end); 
var temp;
//Put them on correct index
for (var i=0;i<numberofvalues;i++){ 
  temp=dval[i]; 
  countval[temp]=countval[temp]+1; 
} 
offset=0; 
for (var i=start;i<end;i++){ 
dval.fill(i,offset,offset+countval[i]); 
offset=offset+countval[i]; 
} 
}

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 05:50 -0700
  Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 11:54 -0700
    Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 11:57 -0700
      Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 12:40 -0700
        Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 13:20 -0700
          Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 13:59 -0700
            Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:02 -0700
            Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:05 -0700
            Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:06 -0700
        Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 13:26 -0700
          Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 14:16 -0700
            Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:23 -0700
              Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 14:40 -0700
                Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:48 -0700
                Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 14:53 -0700
                Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 15:08 -0700
                Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:51 -0700
                Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 15:11 -0700
            Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:27 -0700
              Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 14:29 -0700
    Re: Improve my sort! Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-05 20:21 +0100
      Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-05 16:14 -0800
        Re: Improve my sort! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-06 00:23 +0000
          Re: Improve my sort! Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-11-06 02:53 +0100
  Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 12:02 -0700
    Re: Improve my sort! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-04 20:22 +0000
      Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 13:48 -0700
        Re: Improve my sort! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-04 22:08 +0000
          Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 15:14 -0700
            Re: Improve my sort! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-11-04 23:12 +0000
              Re: Improve my sort! jonas.thornvall@gmail.com - 2017-11-04 17:14 -0700
          Re: Improve my sort! "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-11-04 15:16 -0700

csiph-web