Click here to Skip to main content
15,896,063 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: print in list box Pin
With_problem9-Aug-06 20:25
With_problem9-Aug-06 20:25 
AnswerRe: print in list box [modified] Pin
Amar Sutar9-Aug-06 19:49
Amar Sutar9-Aug-06 19:49 
GeneralRe: print in list box [modified] Pin
With_problem9-Aug-06 20:26
With_problem9-Aug-06 20:26 
AnswerRe: print in list box Pin
Hamid_RT9-Aug-06 21:54
Hamid_RT9-Aug-06 21:54 
QuestionSTL headache Pin
Waldermort9-Aug-06 17:32
Waldermort9-Aug-06 17:32 
AnswerRe: STL headache Pin
Christian Graus9-Aug-06 17:38
protectorChristian Graus9-Aug-06 17:38 
AnswerRe: STL headache Pin
Zac Howland10-Aug-06 4:38
Zac Howland10-Aug-06 4:38 
QuestionQuicksort algorithm is Causing stack overflow [modified] Pin
JKallen9-Aug-06 16:43
JKallen9-Aug-06 16:43 
I do not understand why this is happening, however the following functions work for small numbers of data, but for larger numbers (ie 100,000 to 1,000,000) I get a stack overflow. These are protected functions of the class "Sample." Sample has a one dimensional dynamically allocated array of doubles pointed to by the m_data variable.

Any help would be appreciated because I have not been able to find a solution to this

Thanks

<br />
void Sample::quicksort(signed long int top, signed long int bottom){<br />
	signed int long middle;<br />
	if (top < bottom){<br />
		middle = partition(top, bottom);<br />
		quicksort(top, middle);<br />
		quicksort(middle+1, bottom);<br />
	}<br />
	return;<br />
}<br />
<br />
<br />
signed long int Sample::partition(signed long int top, signed long int bottom){<br />
	double x = *(m_data + top);<br />
	signed long int i = top - 1;<br />
	signed long int j = bottom + 1;<br />
	double temp;<br />
	do{<br />
		do{<br />
			j--;<br />
		}while (x > *(m_data+j));<br />
<br />
		do{<br />
			i++;<br />
		}while (x < *(m_data+i));<br />
		if (i < j){<br />
			temp = *(m_data+i);<br />
			*(m_data+i) = *(m_data+j);<br />
			*(m_data+j) = temp;<br />
		}<br />
	}while (i < j);     <br />
	return j;           // returns middle index <br />
}<br />

AnswerRe: Quicksort algorithm is Causing stack overflow Pin
PJ Arends9-Aug-06 16:53
professionalPJ Arends9-Aug-06 16:53 
GeneralRe: Quicksort algorithm is Causing stack overflow Pin
JKallen9-Aug-06 16:58
JKallen9-Aug-06 16:58 
AnswerRe: Quicksort algorithm is Causing stack overflow Pin
Christian Graus9-Aug-06 16:54
protectorChristian Graus9-Aug-06 16:54 
GeneralRe: Quicksort algorithm is Causing stack overflow Pin
JKallen9-Aug-06 17:00
JKallen9-Aug-06 17:00 
GeneralRe: Quicksort algorithm is Causing stack overflow Pin
Christian Graus9-Aug-06 17:02
protectorChristian Graus9-Aug-06 17:02 
GeneralRe: Quicksort algorithm is Causing stack overflow Pin
JKallen9-Aug-06 17:04
JKallen9-Aug-06 17:04 
GeneralRe: Quicksort algorithm is Causing stack overflow Pin
Christian Graus9-Aug-06 17:40
protectorChristian Graus9-Aug-06 17:40 
AnswerRe: Quicksort algorithm is Causing stack overflow Pin
Gerald Schwab9-Aug-06 18:07
Gerald Schwab9-Aug-06 18:07 
AnswerRe: Quicksort algorithm is Causing stack overflow Pin
David Crow10-Aug-06 4:05
David Crow10-Aug-06 4:05 
AnswerRe: Quicksort algorithm is Causing stack overflow Pin
Hamid_RT10-Aug-06 8:15
Hamid_RT10-Aug-06 8:15 
QuestionEnum local security groups in NTFS folder ACL Pin
fourierman9-Aug-06 16:32
fourierman9-Aug-06 16:32 
AnswerRe: Enum local security groups in NTFS folder ACL Pin
Milton Karimbekallil9-Aug-06 23:45
Milton Karimbekallil9-Aug-06 23:45 
QuestionComparing images.... Visual C++ (MFC) Pin
cheng859-Aug-06 16:06
cheng859-Aug-06 16:06 
AnswerRe: Comparing images.... Visual C++ (MFC) Pin
Christian Graus9-Aug-06 16:55
protectorChristian Graus9-Aug-06 16:55 
AnswerRe: Comparing images.... Visual C++ (MFC) Pin
PJ Arends9-Aug-06 16:59
professionalPJ Arends9-Aug-06 16:59 
GeneralRe: Comparing images.... Visual C++ (MFC) Pin
kaushal kishore sharma5-Oct-08 22:24
kaushal kishore sharma5-Oct-08 22:24 
AnswerRe: Comparing images.... Visual C++ (MFC) Pin
Hamid_RT9-Aug-06 22:25
Hamid_RT9-Aug-06 22:25 

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.