Artemis: Improved Performance of OpsVector::SortVector #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactored the OpsVector::SortVector function to improve its performance. Removed the original nested loop approach, which had a time complexity of O(n^2), and replaced it with a more efficient sorting algorithm, std::sort, with a time complexity of O(n log n)."
}
Primes: Optimized Prime Number Check
{
"title": "Optimized Prime Number Check",
"description": "Optimized the IsPrime method to reduce the number of iterations and improve performance. Simplified the method by removing redundant checks, implemented early exit for small prime numbers, and simplified the loop."
}
Optimized SumModulus function using direct sum calculation instead of array storage
{
"title": "Optimized SumModulus function",
"description": "Simplified the SumModulus function by eliminating unnecessary array storage and direct calculation of the sum."
}
Improved performance and readability of CountPairs function
{
"title": "Improved CountPairs function",
"description": "Refactored the CountPairs function to use a hash map to count occurrences of each element in the vector, reducing the time complexity from O(n^2) to O(n)."
}
Improved CountDuplicates algorithm
{
"title": "Improved CountDuplicates algorithm",
"description": "Optimized the CountDuplicates method by reducing the number of iterations and improving time complexity. Introduced std::min to calculate the minimum size of the two input vectors and combined the two nested loops into a single loop."
}
Fix Slice method to correctly start iterating from the specified start index
{
"title": "Fix Slice method",
"description": "Updated the Slice method of the OpsList class to correctly start iterating from the specified start index."
}
Simplified Triangle Sum Algorithm
{
"title": "Simplified Triangle Sum Algorithm",
"description": "Simplified the SumTriangle method in DoubleForLoop by removing redundant code and optimizing the algorithm."
}
Simplified SumRange function by optimizing the algorithm
{
"title": "Simplified SumRange function",
"description": "Simplified the SumRange function in the SingleForLoop class by using the formula for the sum of an arithmetic sequence instead of a naive algorithm that uses an array and two loops.