Code Comments
Programming Forum and web based access to our favorite programming groups.On Wed, 2 Apr 2008 21:10:22 -0500, stan <smoore@exis.net> wrote: >I'll go out on a limb here and guess that you're self taught. You might >want to consider a course in algorithms if you're really interested in >programming. No thanks. >You clearly seem concerned with appearances as evidenced by >your taunts. You can't even imagine how much it would improve your >standing with programmers if you could replace "doubt" and "guess" >with a clear, correct, and concise analysis of an algorithm. I already posted the reason why Hasmap is faster than sorted map in this situation. I have tested both version. > >And your reading skills have already been clearly demonstrated. By the way, I checked your posting history for this newsgroup. Other than one post in "Best book" thread, all your posts are in the threads started by me :) How come? Did I inspire you so much that you started posting to this newsgroup regularly? Do you have a crush on me?
Post Follow-up to this messageIn article <2lp7v3pqft8c5betsa8fg3lbu5t39k2qqa@4ax.com>, Razii <DONTwhatevere3e@hotmail.com> wrote: >On 02 Apr 2008 14:44:59 GMT, ytrembla@nyx.nyx.net (Yannick Tremblay) >wrote: > > >I doubt it's that easy to trigger worse case scenario. You will need >to read hashing algorithm and then write a bible size book with >specifically chosen data. Regardless if it is easy or hard, if you are going to release software in the wild, then you must make sure that a nasty character can't destroy your application simply by looking up the Java Hash algorithm and feeding it hand prepared data. Read the history of buffer overflow exploit to learn to what extend peoples will go to break programs. A lot of search/sort/hash algorithm have worse case scenario that are maybe unlikely to be found naturally but rather easy to generate. Some examples would be: already sorted data, almost already sorted data, data sorted in reverse order. Although random data is unlikely to trigger any of the above, it is not that uncommonly found in the wild and a good programmer must be aware of these potential problems and protect his software against it. So if you any real interest in algorithms, try pre-sorting your text before attempting your test. By the way, IMO, the best solution to your problem is: $ sort bible.txt > sortedbible.txt Using such an utility, generating somewhat sorted data is trivial. e,g: $ sort -r bible.txt > reversesortedbible.txt $ sort bible.txt > doublesortedbible.txt && sort bible.txt >> doublesortedbible.txt Very very simple.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.