Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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.
 
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)




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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.