1. why is that comb sort runs faster than merge sort ??
in theory, merge sort should be better than comb sort, right ? O(n log n) is better than O(n2)
however, in practical test on rathena emulator when .@total = 100, comb sort run 16~32 mili-seconds merge sort run 31~47 mili-seconds
something is wrong here
my 1st assumption is my merge sort is not efficient, maybe it can be improve ... however @Euphy told me maybe its just script engine problem ...
can someone test here with hercules emulator and confirm comb sort is faster than merge sort ?
==============================
2. it seems I'm not able to write this kind of algorithm I'm trying to replicate the way that I have used in my comb_sort function
dispbottom .@array[ .@r[.@i] ] +"";
so that I can list out the index of the array I believe display with the index of the sorted array is better than getting output from sorted array because like I said in this topic http://rathena.org/board/topic/92070-suggestion-new-scriptcommand-search-array/?p=242896 I want the index of the sorted array to display the highest score, or the lowest number
I wish someone can point me some light on how to get the sorted index done because comb sort use index swap, and I can easily do it, but merge sort use array merge <.<
ok I just recently cracked @KeyWorld's merge sort algorithm in this topic
http://www.eathena.ws/board/index.php?s=&showtopic=180080&view=findpost&p=1293102
here is the script
http://rathena.org/board/pastebin/jdsshuef1ic/
I have 2 questions
1.
why is that comb sort runs faster than merge sort ??
in theory, merge sort should be better than comb sort, right ?
O(n log n) is better than O(n2)
however, in practical test on rathena emulator
when .@total = 100,
comb sort run 16~32 mili-seconds
merge sort run 31~47 mili-seconds
something is wrong here
my 1st assumption is my merge sort is not efficient, maybe it can be improve
... however @Euphy told me maybe its just script engine problem ...
can someone test here with hercules emulator and confirm comb sort is faster than merge sort ?
==============================
2.
it seems I'm not able to write this kind of algorithm
I'm trying to replicate the way that I have used in my comb_sort function
so that I can list out the index of the array
Edited by AnnieRuruI believe display with the index of the sorted array is better than getting output from sorted array
because like I said in this topic
http://rathena.org/board/topic/92070-suggestion-new-scriptcommand-search-array/?p=242896
I want the index of the sorted array to display the highest score, or the lowest number
I wish someone can point me some light on how to get the sorted index done
because comb sort use index swap, and I can easily do it, but merge sort use array merge <.<
Share this post
Link to post
Share on other sites