14,843,944 members
Home / Discussions / C / C++ / MFC

# C / C++ / MFC

 Re: print in list box With_problem9-Aug-06 20:25 With_problem 9-Aug-06 20:25
 Re: print in list box [modified] Amar Sutar9-Aug-06 19:49 Amar Sutar 9-Aug-06 19:49
 Re: print in list box [modified] With_problem9-Aug-06 20:26 With_problem 9-Aug-06 20:26
 Re: print in list box Hamid_RT9-Aug-06 21:54 Hamid_RT 9-Aug-06 21:54
 STL headache Waldermort9-Aug-06 17:32 Waldermort 9-Aug-06 17:32
 Re: STL headache Christian Graus9-Aug-06 17:38 Christian Graus 9-Aug-06 17:38
 Re: STL headache Zac Howland10-Aug-06 4:38 Zac Howland 10-Aug-06 4:38
 Quicksort algorithm is Causing stack overflow [modified] JKallen9-Aug-06 16:43 JKallen 9-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 Copy Code ```
void Sample::quicksort(signed long int top, signed long int bottom){
signed int long middle;
if (top < bottom){
middle = partition(top, bottom);
quicksort(top, middle);
quicksort(middle+1, bottom);
}
return;
}

signed long int Sample::partition(signed long int top, signed long int bottom){
double x = *(m_data + top);
signed long int i = top - 1;
signed long int j = bottom + 1;
double temp;
do{
do{
j--;
}while (x > *(m_data+j));

do{
i++;
}while (x < *(m_data+i));
if (i < j){
temp = *(m_data+i);
*(m_data+i) = *(m_data+j);
*(m_data+j) = temp;
}
}while (i < j);
return j; // returns middle index
}
```
 Re: Quicksort algorithm is Causing stack overflow PJ Arends9-Aug-06 16:53 PJ Arends 9-Aug-06 16:53
 Re: Quicksort algorithm is Causing stack overflow JKallen9-Aug-06 16:58 JKallen 9-Aug-06 16:58
 Re: Quicksort algorithm is Causing stack overflow Christian Graus9-Aug-06 16:54 Christian Graus 9-Aug-06 16:54
 Re: Quicksort algorithm is Causing stack overflow JKallen9-Aug-06 17:00 JKallen 9-Aug-06 17:00
 Re: Quicksort algorithm is Causing stack overflow Christian Graus9-Aug-06 17:02 Christian Graus 9-Aug-06 17:02
 Re: Quicksort algorithm is Causing stack overflow JKallen9-Aug-06 17:04 JKallen 9-Aug-06 17:04
 Re: Quicksort algorithm is Causing stack overflow Christian Graus9-Aug-06 17:40 Christian Graus 9-Aug-06 17:40
 Re: Quicksort algorithm is Causing stack overflow Gerald Schwab9-Aug-06 18:07 Gerald Schwab 9-Aug-06 18:07
 Re: Quicksort algorithm is Causing stack overflow David Crow10-Aug-06 4:05 David Crow 10-Aug-06 4:05
 Re: Quicksort algorithm is Causing stack overflow Hamid_RT10-Aug-06 8:15 Hamid_RT 10-Aug-06 8:15
 Enum local security groups in NTFS folder ACL fourierman9-Aug-06 16:32 fourierman 9-Aug-06 16:32
 Re: Enum local security groups in NTFS folder ACL Milton Karimbekallil9-Aug-06 23:45 Milton Karimbekallil 9-Aug-06 23:45
 Comparing images.... Visual C++ (MFC) cheng859-Aug-06 16:06 cheng85 9-Aug-06 16:06
 Re: Comparing images.... Visual C++ (MFC) Christian Graus9-Aug-06 16:55 Christian Graus 9-Aug-06 16:55
 Re: Comparing images.... Visual C++ (MFC) PJ Arends9-Aug-06 16:59 PJ Arends 9-Aug-06 16:59
 Re: Comparing images.... Visual C++ (MFC) kaushal kishore sharma5-Oct-08 22:24 kaushal kishore sharma 5-Oct-08 22:24
 Re: Comparing images.... Visual C++ (MFC) Hamid_RT9-Aug-06 22:25 Hamid_RT 9-Aug-06 22:25
 Last Visit: 31-Dec-99 18:00     Last Update: 21-Apr-21 12:41 Refresh ᐊ Prev1...8544854585468547854885498550855185528553 Next ᐅ