1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-29 20:21:50 +02:00

Merge pull request #5713 from YutharsanS/patch-1

Change of content in 104-exponential.md
This commit is contained in:
dsh
2024-05-22 11:39:30 +01:00
committed by GitHub

View File

@@ -6,7 +6,7 @@ Exponential algorithms are those that grow at a rate of 2^n. This means that for
def exponential(n): def exponential(n):
if n == 0: if n == 0:
return 1 return 1
return 2 * exponential(n - 1) return exponential(n - 1) + exponential(n - 1)
``` ```
As you can see, the algorithm's runtime grows exponentially. For each additional input, the algorithm will take twice as long to run. As you can see, the algorithm's runtime grows exponentially. For each additional input, the algorithm will take twice as long to run.