Wrox Programmer Forums
|
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 February 24th, 2010, 09:09 PM
Registered User
 
Join Date: Feb 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH 12 page 301 (overloaded method)

I was having problems with this overloaded method.......mySort.quickSort(data.Length - 1); it is only sending one para. over to this method.......public void quickSort(int first, int last). Where is the second para for this method??
Thanks for you time, this has been a great book so far!!!

private void btnSort_Click(object sender, EventArgs e)
{
int i;
clsSort mySort = new clsSort(data);

mySort.quickSort(data.Length - 1);

for (i = 0; i < data.Length; i++)
{
lstSorted.Items.Add(data[i].ToString());
}



public void quickSort(int first, int last)
{
int start;
int end;

start = first;
end = last;

if (last - first >= 1)
{
int pivot = data[first];

while (end > start)
{

while (data[start] <= pivot && start <= last && end > start)
start++;

while (data[end] > pivot && end >= first && end >= start)
end--;
if (end > start)
swap(start, end);
}
swap(first, end);
quickSort(first, end - 1);
quickSort(end + 1, last);
}
else
{
return;
}
}
 
Old March 2nd, 2010, 03:02 PM
Friend of Wrox
 
Join Date: Sep 2008
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Oh-oh...

My bad...

If you look at the code that's available on the Wrox website, you'll see that the source has the call as:

mySort.quickSort(0, data.Length - 1);

Somehow, the first argument got dropped and neither I nor the tech ed caught it. As a general rule, if you see something in the book that looks stupid, first check the source available on the web to see if it's different there. Usually, that code's correct since it is never editted. If that doesn't fix it, then we've done something even more stupid...

Sorry for the error...
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)





Similar Threads
Thread Thread Starter Forum Replies Last Post
ch 12 php logins ejurasin BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 March 13th, 2006 02:24 PM
Ch 12, Try It Out, p.442, Line 3. Page not appear VictorVictor BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 March 9th, 2006 05:18 PM
C# Overloaded Method argument problem Scott Rider C# 1 January 3rd, 2005 06:39 PM
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.