mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-04 02:56:40 +08:00
* formatting source-code for72c365dcd3* Fixed Bug [munmap_chunck() core dumped] * formatting source-code forb06bbf4dc6* fixed line spacing * fixed line spacing * fixed documentation * closed the paranthesis of line 3 * formatting source-code for8233eda889* Bug Fix heap sort [Fresh Implementation] * formatting source-code fore464ddac36* Bug Fix heap sort [Fresh Implementation] * formatting source-code for803981c831* switched to normal functions from lambda * formatting source-code forced5dcd6c4* Added template and test cases * formatting source-code for7c8617fa46* fixed docs * fixed line spacing in tests * fix docs * Multiplication result may overflow 'int' before it is converted to 'long'. * fixed cpplint long -> int64 * fixed compiler error Co-authored-by: github-actions <${GITHUB_ACTOR}@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