C-Input/Output From File-Insertion Sort -
how can programming? can give many hint or advice me?
- c: read file , words alphabetic sorted (i did reading,but didn't sorting)
it looks problem worded poorly; c
supposed direct read words unsorted list? make sense me.
anyway, design insertionsort
function match prototype of standard library's qsort
. way can reuse code , move logic comparing 2 words out of sort function. determining whether word "comes before" word trivial.
for calculating running time of algorithm, take @ clock
function. not return running time of program better indicator of how cpu time sorting algorithm took. way minimize running time of program refrain making system calls , heap allocations in loops, if possible. note insertion sort has bad worst-case time complexity almost-sorted data. selecting right sorting algorithm data set can make big difference.
Comments
Post a Comment