From 0006517e748eeced7fbcbad384aa35655c1c67a3 Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Mon, 11 Mar 2019 12:23:32 -0400 Subject: [PATCH] Changed everything to bubbleSort because quickSort was causing a stack overflow --- Algorithms.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Algorithms.h b/Algorithms.h index 73e728f..f8de29c 100644 --- a/Algorithms.h +++ b/Algorithms.h @@ -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;