Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
JT
Posts:
568
Registered:
4/7/12
|
|
Re: Just finished the fastest ever, general purpose sorting algorithm.
Posted:
Jan 6, 2013 10:32 PM
|
|
On 7 Jan, 03:56, forbisga...@gmail.com wrote: > On Sunday, January 6, 2013 6:18:16 PM UTC-8, JT wrote: > > On 7 Jan, 02:49, forbisga...@gmail.com wrote: > > > > On Sunday, January 6, 2013 9:53:53 AM UTC-8, JT wrote: > > > > > It is not java it is JS if you can not manage copy paste the text into > > > > > a txt document, rename extension .html, doubleclick and press the > > > > > button to sort i am afraid you are beyond help. > > > > What weight would you assign to the word "irrational"? If you > > > > assign it to the same weight as "irrationals" then how do you > > > > differentiate between the two words? If the index is in the > > > > range 256^11 so that each word up to 11 characters is assigned > > > > a unique weight then your output loop is going to take some time > > > > and will be quite uproductive for a page of text or even some > > > > 2000 words. > > > I've just told you that the pointer implementation of countsort do not > > > need to allocate memory, and that it is recursive working and run each > > > digit length in their bransch. That should be enough to implement it. > > But your code is: > > valdist=""; > for (j=0;j<256;j++){ > temp2=countval[j] > for (k=0;k<temp2;k++){ > valdist=valdist+j+","; > } > > Where does that 256 come in? You're reporting out by > spinning through all of the indicies even those with > no instances. A sparse table would waste time spinning > through the entries, reporting nothing. While there are > associative memories that will handle arbitrary indicies > they are quite expensive and don't really help you in the > way you might think. No a dynamic alloc memory pointer solution using a binary tree will not have any empty indeces. I will not show you howto implement the recursive algorithm with digit branches, because if you cannot code it you simply not worthy. I did already implement it in -97 so it has been around for a while, but it is hardly public knowledge outside certain inteligence bureaus. You may think i am joking and i am, the joke is on you.
|
|
|
|