mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-07 20:46:16 +08:00
* Reworked selection_sort.cpp with fixes. * Added Recursive implementation for tree traversing * Fix #2 * Delete recursive_tree_traversals.cpp * Update selection_sort.cpp * Changes done in selection_sort_iterative.cpp * updating DIRECTORY.md * clang-format and clang-tidy fixes for4681e4f7* Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update selection_sort_iterative.cpp * Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes forca2a7c64* Finished changes requested by ayaankhan98. * Reworked on changes. * clang-format and clang-tidy fixes forf79b79b7* Corrected errors. * Fix #2 * Fix #3 * Major Fix #3 * clang-format and clang-tidy fixes for79341db8* clang-format and clang-tidy fixes for9bdf2ce4* Update selection_sort_iterative.cpp * clang-format and clang-tidy fixes for9833d7a7* clang-format and clang-tidy fixes forb7726460Co-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Abhinn Mishra <49574460+mishraabhinn@users.noreply.github.com>
Prime factorization
Prime Factorization is a very important and useful technique to factorize any number into its prime factors. It has various applications in the field of number theory.
The method of prime factorization involves two function calls. First: Calculating all the prime number up till a certain range using the standard Sieve of Eratosthenes.
Second: Using the prime numbers to reduce the the given number and thus find all its prime factors.
The complexity of the solution involves approx. O(n logn) in calculating sieve of eratosthenes O(log n) in calculating the prime factors of the number. So in total approx. O(n logn).
Requirements: For compile you need the compiler flag for C++ 11