| | |
confused about shell sort ...
![]() |
•
•
Join Date: Dec 2004
Posts: 5
Reputation:
Solved Threads: 0
I am allitle confused about shell sorting , how exactly is it done ?
Say I have an array of 25 , 15 , 20 ,40,9,2,4,5,100,1
The next step would be gap1/2 , which would be 5 right ?
so then it would look like
2 15 20 40 9 25 4 5 100
after that what do I do ?
I am guessing you take 5 and divide by 2 again ?
Then , It'd be
2 15 9 40 4 25 20 5 100 1
then finally 2/2 which is one and it'd be
2,9,15,4,40,20,5,25,1,100 ?
I am confused , what did I do wrong ?
Also , what is the equation for the worst case ? I can't fidn these answers anywhere on the web, everyone website I visited has really confusing notations.
I think the worst case is Log N , isn't it ?
Please help me out , thanks in advanced :mrgreen:
Say I have an array of 25 , 15 , 20 ,40,9,2,4,5,100,1
The next step would be gap1/2 , which would be 5 right ?
so then it would look like
2 15 20 40 9 25 4 5 100
after that what do I do ?
I am guessing you take 5 and divide by 2 again ?
Then , It'd be
2 15 9 40 4 25 20 5 100 1
then finally 2/2 which is one and it'd be
2,9,15,4,40,20,5,25,1,100 ?
I am confused , what did I do wrong ?
Also , what is the equation for the worst case ? I can't fidn these answers anywhere on the web, everyone website I visited has really confusing notations.
I think the worst case is Log N , isn't it ?
Please help me out , thanks in advanced :mrgreen:
![]() |
Similar Threads
- Quick question on Shell sort complexity (Computer Science)
- help!shell sort, deck... (C)
- Shell Sort w/ fibonacci numbers...HELP!!! Due Friday (C++)
- Shell HELP! (Getting Started and Choosing a Distro)
Other Threads in the C Forum
- Previous Thread: making mobile phone snake game using C
- Next Thread: Deleting a record from a file
| Thread Tools | Search this Thread |
* adobe ansi api array binarysearch centimeter changingto char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax database directory feet fflush fgets file floatingpointvalidation fork frequency function givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux highest histogram homework i/o inches infiniteloop input interest intmain() iso keyboard kilometer km linked linkedlist linux linuxsegmentationfault list locate looping lowest match meter microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc program programming pyramidusingturboccodes read recv recvblocked repetition reversing scanf scheduling segmentationfault send single socketprograming socketprogramming stack standard string suggestions systemcall unix urboc user voidmain() wab whythiscodecausesegmentationfault win32api windows.h windowsapi





