Click here to Skip to main content
15,887,746 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionBest coding practice. Pin
Member 41945936-Apr-09 18:08
Member 41945936-Apr-09 18:08 
AnswerRe: Best coding practice. [modified] Pin
Luc Pattyn7-Apr-09 4:27
sitebuilderLuc Pattyn7-Apr-09 4:27 
GeneralRe: Best coding practice. Pin
Member 41945937-Apr-09 14:40
Member 41945937-Apr-09 14:40 
GeneralRe: Best coding practice. Pin
Luc Pattyn7-Apr-09 15:21
sitebuilderLuc Pattyn7-Apr-09 15:21 
GeneralRe: Best coding practice. Pin
Member 41945937-Apr-09 16:23
Member 41945937-Apr-09 16:23 
GeneralRe: Best coding practice. Pin
Member 419459310-Apr-09 19:55
Member 419459310-Apr-09 19:55 
GeneralRe: Best coding practice. Pin
Luc 64801111-Apr-09 0:39
Luc 64801111-Apr-09 0:39 
GeneralRe: Best coding practice. Pin
Member 419459311-Apr-09 5:51
Member 419459311-Apr-09 5:51 
Luc,

What's with the membership change? After 5 years and 1,000,000 posts do they take away your Gold Membership? You must have been a very naughty boy.

The timing differences, I believe, are just normal Windows getting in the way of everything. I mean, my development machine is not connected to the internet, it is only doing one thing (executing my program), so why is there all this activity as indicated by the Task Manager? Paging with 4 million bytes involved probably plays a part in it also.

I will execute the two tests again with tracing enabled and pick some shorter tests (my standard testing is the character set A-Z for easy visual checking of results). The tracing will report the number of compares and exchanges, as well as report all of the exchanges as they occur. My algo starts by swapping the middle element for the right end (the pivot) and then finally determines that there is nothing to do (because it is already in order) so it just re-swaps the middle and end, but then it sorts the front half and then sorts the back half, both of which are in order so the same thing happens again twice, then 4 times... If the sort has to reverse the order (ascending data sorted descending), then after the first swap to put the middle at the end, it will end up swapping end elements, working to the middle (since everything is on the wrong side of the pivot), and ends up with a re-swap of the middle and the end.

Dave.
GeneralRe: Best coding practice. Pin
Luc 64801111-Apr-09 6:18
Luc 64801111-Apr-09 6:18 
GeneralRe: Best coding practice. Pin
Member 419459315-Apr-09 8:29
Member 419459315-Apr-09 8:29 
GeneralRe: Best coding practice. Pin
Luc 64801115-Apr-09 8:39
Luc 64801115-Apr-09 8:39 
GeneralRe: Best coding practice. Pin
Member 419459315-Apr-09 9:45
Member 419459315-Apr-09 9:45 
QuestionRotation of Bitmap Pin
CodeOfLife5-Apr-09 16:21
CodeOfLife5-Apr-09 16:21 
AnswerRe: Rotation of Bitmap [modified] Pin
Luc Pattyn5-Apr-09 16:30
sitebuilderLuc Pattyn5-Apr-09 16:30 
GeneralRe: Rotation of Bitmap Pin
CodeOfLife6-Apr-09 6:37
CodeOfLife6-Apr-09 6:37 
GeneralRe: Rotation of Bitmap Pin
Luc Pattyn6-Apr-09 6:59
sitebuilderLuc Pattyn6-Apr-09 6:59 
QuestionCreating RSOM from SOM Pin
Jasmine Pomelo4-Apr-09 14:04
Jasmine Pomelo4-Apr-09 14:04 
QuestionRe: Creating RSOM from SOM Pin
CPallini6-Apr-09 21:39
mveCPallini6-Apr-09 21:39 
AnswerRe: Creating RSOM from SOM Pin
Jasmine Pomelo9-Apr-09 9:38
Jasmine Pomelo9-Apr-09 9:38 
QuestionSingle Elimination - Tournament Brackets Pin
aslamc2-Apr-09 9:32
aslamc2-Apr-09 9:32 
AnswerRe: Single Elimination - Tournament Brackets Pin
Alan Balkany3-Apr-09 4:00
Alan Balkany3-Apr-09 4:00 
QuestionTree algo Pin
dfreeser2-Apr-09 5:58
dfreeser2-Apr-09 5:58 
AnswerRe: Tree algo Pin
Alan Balkany3-Apr-09 3:43
Alan Balkany3-Apr-09 3:43 
GeneralRe: Tree algo Pin
dfreeser3-Apr-09 5:15
dfreeser3-Apr-09 5:15 
GeneralRe: Tree algo Pin
Alan Balkany3-Apr-09 5:42
Alan Balkany3-Apr-09 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.