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


Groups > comp.lang.javascript > #34275 > unrolled thread

Improve my sort!

Started byjonas.thornvall@gmail.com
First post2017-11-04 05:50 -0700
Last post2017-11-04 15:16 -0700
Articles 20 on this page of 32 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  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

Page 1 of 2  [1] 2  Next page →


#34275 — Improve my sort!

Fromjonas.thornvall@gmail.com
Date2017-11-04 05:50 -0700
SubjectImprove my sort!
Message-ID<29745427-ec33-4eea-b8ac-e72ef8b416de@googlegroups.com>
<HTML> 
<HEAD><TITLE>SORT</TITLE></HEAD> 
<BODY>
<TABLE BGCOLOR="WHITE" BORDER=1><TH>GENERATE RANDOM NUMBERS</TH> <TR><TD>
<FORM NAME=random onSubmit="newrandom(); return false;"> 
Smallest number <input type="text" name="startrange" value="0"><br>
Biggest number <input type="text" name="endrange" value="1000"><br>
Values to generate <input type="text" name="xvalues" value="10000000"><P>
<input type="submit" value="GENERATE"><P>
VALUES TO SORT "PRINTOUT ONLY FOR ARRAY WITH LESS THEN 100000 ELEMENTS"<BR> 
<TEXTAREA NAME=sort COLS=120 ROWS=8>
</TEXTAREA><BR> 
</FORM>
</TD></TR></TABLE>
<TABLE BGCOLOR="WHITE" BORDER=!>
<TH>COMPARE SORT TIMINGS</TH>
<TR><TD>CHOOSE SORT ALGORITHM
<select id="mySelect" onchange="chosesort();">
<option value="index">JT_INDEXSORT</option>
<option value="javascript">javascript_sort</option>
<option value="quick">QUICKSORT</option>
</select>
<FORM NAME=sort onSubmit="chosesort(); return false;"> 
<input type=submit value="SORT"> TIME MS <input type="text" name="functime" value=""><br>
SORTED VALUES PRINTOUT "ONLY IF ARRAY HAS LESS THEN 100000 ELEMENTS":<BR>
<TEXTAREA TYPE=TEXT NAME=distrib COLS=120 ROWS=23>
</TEXTAREA><BR> 
</FORM> 
</TD></TR></TABLE>
</BODY>
<SCRIPT LANGUAGE="Javascript"> 
newrandom();
chosesort();
function newrandom(){
dval=new Array();
start=document.random.startrange.value;
end=document.random.endrange.value;
start=Number(start);
end=Number(end);
numberofvalues=document.random.xvalues.value;
//Generate random values
for (var i=0;i<numberofvalues;i++){
number=Math.floor(Math.random() * end) + start; 
dval[i]=number;
}
if (dval.length<100000) {document.random.sort.value=dval;} else {document.random.sort.value=dval.length+" elements in array"};
}
function chosesort(){
selectedsort = document.getElementById("mySelect").value;
if (selectedsort=="index"){jtindexsort();}
else if (selectedsort=="javascript"){javascriptNativesort();}
else if (selectedsort=="bubble"){bubbleSort();}
else if (selectedsort=="quick"){ quickSort(dval,0,numberofvalues);}
if (dval.length<100000) {printout();} else {document.sort.distrib.value=dval.length+" sorted in array"};
}
function quickSort(arr, left, right)
{
var starttime = new Date().getTime();
var i = left;
var j = right;
var tmp;
pivotidx = (left + right) / 2; 
var pivot = parseInt(arr[pivotidx.toFixed()]); 
/* partition */
while (i <= j)
{
while (parseInt(arr[i]) < pivot)
i++;
while (parseInt(arr[j]) > pivot)
j--;
if (i <= j)
{
tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
i++;
j--;
}
}
/* recursion */
if (left < j)
quickSort(arr, left, j);
if (i < right)
quickSort(arr, i, right);
var endtime = new Date().getTime();
var timed = endtime - starttime;
document.sort.functime.value=timed;
return arr;
}
function javascriptNativesort(){
var starttime = new Date().getTime();
dval = dval.sort(sortNumber);
var endtime = new Date().getTime();
var timed = endtime - starttime;
document.sort.functime.value=timed;
}
function sortNumber(a, b)
{
return a - b;
}
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;
}
function printout(){
valdist="";
for (var j=0;j<numberofvalues;j++){
valdist+=dval[j]+",";
}
document.sort.distrib.value=valdist; 
}
</SCRIPT>
</HTML>

[toc] | [next] | [standalone]


#34276

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 11:54 -0700
Message-ID<6e1799aa-73cd-4ceb-b6bb-c8e0dd04b378@googlegroups.com>
In reply to#34275
jonas.t...@gmail.com wrote:
> [...]

Fix all of the errors described at <http://jshint.com/>

[toc] | [prev] | [next] | [standalone]


#34278

Fromjonas.thornvall@gmail.com
Date2017-11-04 11:57 -0700
Message-ID<586dd7cc-dbe7-425b-aadb-8177f244bc93@googlegroups.com>
In reply to#34276
Den lördag 4 november 2017 kl. 19:54:58 UTC+1 skrev 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.

[toc] | [prev] | [next] | [standalone]


#34280

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 12:40 -0700
Message-ID<f34550a2-30d4-4d84-a758-f81ad4dddc01@googlegroups.com>
In reply to#34278
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.

[toc] | [prev] | [next] | [standalone]


#34281

Fromjonas.thornvall@gmail.com
Date2017-11-04 13:20 -0700
Message-ID<eceb7877-f92a-46da-aed3-59b280dd7b63@googlegroups.com>
In reply to#34280
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.

Subjective sort? i have no idea what you are on about?

[toc] | [prev] | [next] | [standalone]


#34285

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 13:59 -0700
Message-ID<8640a3c5-a6a3-4a1e-96fa-6ebafcd67b34@googlegroups.com>
In reply to#34281
jonas.t...@gmail.com wrote:
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.
> 
> Subjective sort? i have no idea what you are on about?

You haven't convinced me it's a valid sort (due to mentioned errors) let alone that it's faster than others since I won't trust the results nor implementation.  If it has errors and you claim it works for you, that makes it subjective. 

[toc] | [prev] | [next] | [standalone]


#34286

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:02 -0700
Message-ID<d4da129e-91c9-4a92-8d2e-54603a97be67@googlegroups.com>
In reply to#34285
Den lördag 4 november 2017 kl. 22:00:05 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> 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.
> > 
> > Subjective sort? i have no idea what you are on about?
> 
> You haven't convinced me it's a valid sort (due to mentioned errors) let alone that it's faster than others since I won't trust the results nor implementation.  If it has errors and you claim it works for you, that makes it subjective.

LoL i am sorry your a moron, the code so easy a 7 year old could understand it with some supervision.

[toc] | [prev] | [next] | [standalone]


#34287

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:05 -0700
Message-ID<14417c93-0aa5-4b0f-ac3d-201edf9fcec0@googlegroups.com>
In reply to#34285
Den lördag 4 november 2017 kl. 22:00:05 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> 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.
> > 
> > Subjective sort? i have no idea what you are on about?
> 
> You haven't convinced me it's a valid sort (due to mentioned errors) let alone that it's faster than others since I won't trust the results nor implementation.  If it has errors and you claim it works for you, that makes it subjective.

Someone bring forward the buckets Michael Haufe needs help, anyone can help him out borrow him some buckets?

[toc] | [prev] | [next] | [standalone]


#34288

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:06 -0700
Message-ID<195948c2-330b-40f3-894b-6707cbce7946@googlegroups.com>
In reply to#34285
Den lördag 4 november 2017 kl. 22:00:05 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> 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.
> > 
> > Subjective sort? i have no idea what you are on about?
> 
> You haven't convinced me it's a valid sort (due to mentioned errors) let alone that it's faster than others since I won't trust the results nor implementation.  If it has errors and you claim it works for you, that makes it subjective.

https://www.youtube.com/watch?v=TcZyiYOzsSw&feature=share

[toc] | [prev] | [next] | [standalone]


#34283

Fromjonas.thornvall@gmail.com
Date2017-11-04 13:26 -0700
Message-ID<3e760751-4e27-4aec-9bfe-57139be7f7f9@googlegroups.com>
In reply to#34280
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]; 
} 
}

[toc] | [prev] | [next] | [standalone]


#34289

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 14:16 -0700
Message-ID<53264473-7e2f-41b7-bf95-57fcd0f271f2@googlegroups.com>
In reply to#34283
jonas.t...@gmail.com wrote:
 
> Sure you can't have problem understand the algorithm

I "have problem understand" the presentation. I don't even want to look at the algorithm in it's current form if it can't pass a basic linter and is presented in a quirks mode html page without formatting.

> 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.

Gladly for my years of formal education in the relevant field I don't have to use my "febble" mind to criticize:

<http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A var starttime %3D new Date().getTime()%3B%0D%0A countval %3D new Array()%3B%0D%0A %2F%2FInitiate array range%0D%0A for (j %3D start%3B j < end%3B j%2B%2B) {%0D%0A countval[j] %3D 0%3B%0D%0A }%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A p %3D 0%3B%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A var endtime %3D new Date().getTime()%3B%0D%0A var timed %3D endtime - starttime%3B%0D%0A document.sort.functime.value %3D timed%3B%0D%0A}>

> So tell me what is it you object to?

Without even looking at the algorithm proper:

1- Free variables
2- mixing of DOM and the sorting algorithm
3- Not using the appropriate measurement API for this (performance.now)
4- combining performance measurement with the algorithm
5- redefining i
6- not using array literal notation

> 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]; 
> } 
> }

Again, no thought required on my part here:

<http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A %2F%2FInitiate array range%0D%0A q %3D 0%3B%0D%0A countval.fill(q%2C start%2C end)%3B%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A}>

[toc] | [prev] | [next] | [standalone]


#34290

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:23 -0700
Message-ID<a443cc53-2494-4a27-b3df-1faf350e9a17@googlegroups.com>
In reply to#34289
Den lördag 4 november 2017 kl. 22:16:08 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
>  
> > Sure you can't have problem understand the algorithm
> 
> I "have problem understand" the presentation. I don't even want to look at the algorithm in it's current form if it can't pass a basic linter and is presented in a quirks mode html page without formatting.
> 
> > 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.
> 
> Gladly for my years of formal education in the relevant field I don't have to use my "febble" mind to criticize:
> 
> <http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A var starttime %3D new Date().getTime()%3B%0D%0A countval %3D new Array()%3B%0D%0A %2F%2FInitiate array range%0D%0A for (j %3D start%3B j < end%3B j%2B%2B) {%0D%0A countval[j] %3D 0%3B%0D%0A }%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A p %3D 0%3B%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A var endtime %3D new Date().getTime()%3B%0D%0A var timed %3D endtime - starttime%3B%0D%0A document.sort.functime.value %3D timed%3B%0D%0A}>
> 
> > So tell me what is it you object to?
> 
> Without even looking at the algorithm proper:
> 
> 1- Free variables
> 2- mixing of DOM and the sorting algorithm
> 3- Not using the appropriate measurement API for this (performance.now)
> 4- combining performance measurement with the algorithm
> 5- redefining i
> 6- not using array literal notation
> 
> > 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]; 
> > } 
> > }
> 
> Again, no thought required on my part here:
> 
> <http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A %2F%2FInitiate array range%0D%0A q %3D 0%3B%0D%0A countval.fill(q%2C start%2C end)%3B%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A}>

And still after all this time you come out as an idiot, well that is sad.

[toc] | [prev] | [next] | [standalone]


#34293

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 14:40 -0700
Message-ID<e850437e-e7c2-47c6-80bd-9dd78e2de3dd@googlegroups.com>
In reply to#34290
jonas.t...@gmail.com wrote:

> And still after all this time you come out as an idiot, well that is sad.

Triggered by evidence? What a shame. Obviously you don't want someone to help you "improve [your] sort" as the title says, instead you want a pat on the head and an "A" for effort as long as people don't look too deeply.

Fix the six issues I presented to you and I promise to take your solution more seriously than I do now.

[toc] | [prev] | [next] | [standalone]


#34294

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:48 -0700
Message-ID<6368b184-aec8-4fe1-bfe5-77ed1560a394@googlegroups.com>
In reply to#34293
Den lördag 4 november 2017 kl. 22:40:53 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> 
> > And still after all this time you come out as an idiot, well that is sad.
> 
> Triggered by evidence? What a shame. Obviously you don't want someone to help you "improve [your] sort" as the title says, instead you want a pat on the head and an "A" for effort as long as people don't look too deeply.
> 
> Fix the six issues I presented to you and I promise to take your solution more seriously than I do now.

In what way did you improve the sort?

[toc] | [prev] | [next] | [standalone]


#34296

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 14:53 -0700
Message-ID<21f8cf4a-3404-44bd-9154-83eace9d0ea5@googlegroups.com>
In reply to#34294
jonas.t...@gmail.com wrote:

> In what way did you improve the sort?

By deleting the copy on my computer

[toc] | [prev] | [next] | [standalone]


#34298

Fromjonas.thornvall@gmail.com
Date2017-11-04 15:08 -0700
Message-ID<e1f0f990-bae3-4cad-9edd-c9e2e79d0fe2@googlegroups.com>
In reply to#34296
Den lördag 4 november 2017 kl. 22:53:36 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> 
> > In what way did you improve the sort?
> 
> By deleting the copy on my computer

But then you did not sort anything?
But then again you only copied other peoples crappy algorithms...
Like quicksort, mergesort etc
"To be honest they had their time, in a different era" today they are dinosaurs just like you.

Well when you copy or steal others work you remain an idiot for your whole life did you know?

[toc] | [prev] | [next] | [standalone]


#34295

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:51 -0700
Message-ID<d1cac206-b95f-498a-bd3e-91d776b04cfd@googlegroups.com>
In reply to#34293
Den lördag 4 november 2017 kl. 22:40:53 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
> 
> > And still after all this time you come out as an idiot, well that is sad.
> 
> Triggered by evidence? What a shame. Obviously you don't want someone to help you "improve [your] sort" as the title says, instead you want a pat on the head and an "A" for effort as long as people don't look too deeply.
> 
> Fix the six issues I presented to you and I promise to take your solution more seriously than I do now.

Further i asked the poor inhabitants of comp.lang.javascript to point me to the best textsort and general datasort they can find. And i will "try" to beat it, but anal people are not interested, they wonder about the syntax.....

[toc] | [prev] | [next] | [standalone]


#34299

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2017-11-04 15:11 -0700
Message-ID<c9d04911-ab09-4997-a88d-12f6e1b71c2e@googlegroups.com>
In reply to#34295
jonas.t...@gmail.com wrote:
> Michael Haufe (TNO):
> > jonas.t...@gmail.com wrote:
> > 
> > > And still after all this time you come out as an idiot, well that is sad.
> > 
> > Triggered by evidence? What a shame. Obviously you don't want someone to help you "improve [your] sort" as the title says, instead you want a pat on the head and an "A" for effort as long as people don't look too deeply.
> > 
> > Fix the six issues I presented to you and I promise to take your solution more seriously than I do now.
> 
> Further i asked the poor inhabitants of comp.lang.javascript to point me to the best textsort and general datasort they can find. And i will "try" to beat it, but anal people are not interested, they wonder about the syntax.....

Notation is a tool of thought [1], and it matters. 

Secondly, if you did even a cursory glance at the subject you would have found candidates rather quickly[2]. You may even see the one you're close to reinventing.

[1] <http://www.jsoftware.com/papers/tot.htm>
[2] <https://en.wikipedia.org/wiki/Sorting_algorithm#Comparison_of_algorithms>

[toc] | [prev] | [next] | [standalone]


#34291

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:27 -0700
Message-ID<ec52da20-ef5a-4bc5-bd43-b20bd98e400b@googlegroups.com>
In reply to#34289
Den lördag 4 november 2017 kl. 22:16:08 UTC+1 skrev Michael Haufe (TNO):
> jonas.t...@gmail.com wrote:
>  
> > Sure you can't have problem understand the algorithm
> 
> I "have problem understand" the presentation. I don't even want to look at the algorithm in it's current form if it can't pass a basic linter and is presented in a quirks mode html page without formatting.
> 
> > 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.
> 
> Gladly for my years of formal education in the relevant field I don't have to use my "febble" mind to criticize:
> 
> <http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A var starttime %3D new Date().getTime()%3B%0D%0A countval %3D new Array()%3B%0D%0A %2F%2FInitiate array range%0D%0A for (j %3D start%3B j < end%3B j%2B%2B) {%0D%0A countval[j] %3D 0%3B%0D%0A }%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A p %3D 0%3B%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A var endtime %3D new Date().getTime()%3B%0D%0A var timed %3D endtime - starttime%3B%0D%0A document.sort.functime.value %3D timed%3B%0D%0A}>
> 
> > So tell me what is it you object to?
> 
> Without even looking at the algorithm proper:
> 
> 1- Free variables
> 2- mixing of DOM and the sorting algorithm
> 3- Not using the appropriate measurement API for this (performance.now)
> 4- combining performance measurement with the algorithm
> 5- redefining i
> 6- not using array literal notation
> 
> > 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]; 
> > } 
> > }
> 
> Again, no thought required on my part here:
> 
> <http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A %2F%2FInitiate array range%0D%0A q %3D 0%3B%0D%0A countval.fill(q%2C start%2C end)%3B%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A}>

Please somone?
Can't you see the poor thing needs help, please someone give him some buckets, don't be cruel.

[toc] | [prev] | [next] | [standalone]


#34292

Fromjonas.thornvall@gmail.com
Date2017-11-04 14:29 -0700
Message-ID<52a126f8-2f55-4545-af83-b08921c6f974@googlegroups.com>
In reply to#34291
Den lördag 4 november 2017 kl. 22:27:34 UTC+1 skrev jonas.t...@gmail.com:
> Den lördag 4 november 2017 kl. 22:16:08 UTC+1 skrev Michael Haufe (TNO):
> > jonas.t...@gmail.com wrote:
> >  
> > > Sure you can't have problem understand the algorithm
> > 
> > I "have problem understand" the presentation. I don't even want to look at the algorithm in it's current form if it can't pass a basic linter and is presented in a quirks mode html page without formatting.
> > 
> > > 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.
> > 
> > Gladly for my years of formal education in the relevant field I don't have to use my "febble" mind to criticize:
> > 
> > <http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A var starttime %3D new Date().getTime()%3B%0D%0A countval %3D new Array()%3B%0D%0A %2F%2FInitiate array range%0D%0A for (j %3D start%3B j < end%3B j%2B%2B) {%0D%0A countval[j] %3D 0%3B%0D%0A }%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A p %3D 0%3B%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A var endtime %3D new Date().getTime()%3B%0D%0A var timed %3D endtime - starttime%3B%0D%0A document.sort.functime.value %3D timed%3B%0D%0A}>
> > 
> > > So tell me what is it you object to?
> > 
> > Without even looking at the algorithm proper:
> > 
> > 1- Free variables
> > 2- mixing of DOM and the sorting algorithm
> > 3- Not using the appropriate measurement API for this (performance.now)
> > 4- combining performance measurement with the algorithm
> > 5- redefining i
> > 6- not using array literal notation
> > 
> > > 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]; 
> > > } 
> > > }
> > 
> > Again, no thought required on my part here:
> > 
> > <http://www.typescriptlang.org/play/index.html#src=function jtindexsort() {%0D%0A %2F%2FInitiate array range%0D%0A q %3D 0%3B%0D%0A countval.fill(q%2C start%2C end)%3B%0D%0A var temp%3B%0D%0A %2F%2FPut them on correct index%0D%0A for (var i %3D 0%3B i < numberofvalues%3B i%2B%2B) {%0D%0A temp %3D dval[i]%3B%0D%0A countval[temp] %3D countval[temp] %2B 1%3B%0D%0A }%0D%0A offset %3D 0%3B%0D%0A for (var i %3D start%3B i < end%3B i%2B%2B) {%0D%0A dval.fill(i%2C offset%2C offset %2B countval[i])%3B%0D%0A offset %3D offset %2B countval[i]%3B%0D%0A }%0D%0A}>
> 
> Please somone?
> Can't you see the poor thing needs help, please someone give him some buckets, don't be cruel.

https://www.youtube.com/watch?v=9jH-sGuhBFI

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web