diff options
author | StuartLiv | 2022-10-24 21:26:31 +0000 |
---|---|---|
committer | StuartLiv | 2022-10-24 21:26:31 +0000 |
commit | 2db6cb57d86bfa3616e9f8ede8ac73b30dfe75e1 (patch) | |
tree | 9635b5fec7fada5b5461bc17b655a3f6136974f4 | |
parent | b9ab257c2d46a832e0b3bb904bc40e59daa42481 (diff) |
Added ThetaFibN
-rw-r--r-- | entries/StuartLiv/ThetaFibN.java | 13 | ||||
-rw-r--r-- | people.json | 11 |
2 files changed, 24 insertions, 0 deletions
diff --git a/entries/StuartLiv/ThetaFibN.java b/entries/StuartLiv/ThetaFibN.java new file mode 100644 index 0000000..1e4f431 --- /dev/null +++ b/entries/StuartLiv/ThetaFibN.java @@ -0,0 +1,13 @@ +public class ThetaFibN { + + //Fibonacci(n) is asymptotically in ϴ(Fibonacci(n)) + public int Fibonacci(int n) { + String reference = "0"; + int fib = 1; + for(int i = 1; i <= n; i++) { + fib = reference.length(); + reference = reference.replace("0", "").replace("1", "0") + "1".repeat(fib); + } + return fib; + } +} diff --git a/people.json b/people.json index 248c644..bb44dde 100644 --- a/people.json +++ b/people.json @@ -166,6 +166,17 @@ } ] }, + { + "github": "StuartLiv", + "name": "Stuart Livingstone", + "title": "BSc Student, UBC", + "entries": [ + { + "name": "ThetaFibN", + "link": "./entries/StuartLiv/ThetaFibN.java" + } + ] + }, { "github": "Tarcisio-Teixeira", "name": "Tarcísio Teixeira", |