Created
February 27, 2021 04:44
-
-
Save eengineergz/a1e6dec81f0639818db7f9a8e76b3992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// O(log(n)) | |
function logarithmic1(n) { | |
if (n <= 1) return; | |
logarithmic1(n / 2); | |
} | |
// O(log(n)) | |
function logarithmic2(n) { | |
let i = n; | |
while (i > 1) { | |
i /= 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment