Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3
This is the forum to discuss the Wrox book Beginning C# 3.0 : An Introduction to Object Oriented Programming by Jack Purdum; ISBN: 9780470261293
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 3.0 : An Introduction to Object Oriented Programming ISBN: 978-0-470-26129-3 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 30th, 2010, 06:50 AM
Registered User
 
Join Date: Nov 2010
Location: Noardburgum, Friesland, The Netherlands
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default Ch 12 QuickSort too much calls to doSort()?

In listing 12-4, method getPivotPoint does a call to
Code:
doSort(first, end-1)
I feel this call isn't needed at all. If I remove it from the code, the sorting still works.

Also, listing 12-4 contains 3 calls to doSort while the non generic version in listing 12-2 only contains two calls. I think that in listing 12-4, the two recursive calls inside method doSort itself are all you need.
  #2 (permalink)  
Old November 30th, 2010, 03:56 PM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Redundant call?

You're right...it does work fine on both even and odd numbers of items without the call to doSort(). Quite honestly, I've slept since I wrote this code and have no idea why I put it in there!
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
The Following User Says Thank You to DrPurdum For This Useful Post:
comecme (December 16th, 2010)
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 12 LoadTimeSheet() Problem chuck BOOK: Beginning VB.NET Databases 11 July 26th, 2012 11:48 AM
CH 12 login nightmare gegala BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 December 31st, 2007 09:34 AM
Array Intializting problem in QuickSort shah123 C# 3 March 27th, 2007 09:18 AM
Ch. 4 & Ch. 12 athena BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 23rd, 2004 10:54 AM



All times are GMT -4. The time now is 01:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.