Changed everything to bubbleSort because

quickSort was causing a stack overflow
This commit is contained in:
2019-03-11 12:23:32 -04:00
parent 4367c34874
commit 0006517e74

View File

@@ -120,7 +120,7 @@ struct DynamicInt64Array getPrimes(int64_t goalNumber){
}
}
quickSortDynamicInt64Array(&primes);
bubbleSortDynamicInt64Array(&primes);
return primes;
}
@@ -162,7 +162,7 @@ struct DynamicInt64Array getNumPrimes(int64_t numberOfPrimes){
}
//The numbers should be in order, but sort them anyway just in case
quickSortDynamicInt64Array(&primes);
bubbleSortDynamicInt64Array(&primes);
return primes;
}
@@ -183,7 +183,6 @@ struct DynamicInt64Array getFactors(int64_t goalNumber){
++cnt;
}
}
//If it didn't find any factors in the primes the number itself must be prime
if(factors.size == 0){
pushBackDynamicInt64Array(&factors, goalNumber);
@@ -227,7 +226,7 @@ struct DynamicInt64Array getDivisors(int64_t num){
}
}
//Sort the vector for neatness
quickSortDynamicInt64Array(&divisors);
bubbleSortDynamicInt64Array(&divisors);
//Return the vector of divisors
return divisors;