Skip to content

Instantly share code, notes, and snippets.

View AnasAboreeda's full-sized avatar
📚
learning one thing about everything and learning everything about one thing

Anas Aboreeda AnasAboreeda

📚
learning one thing about everything and learning everything about one thing
View GitHub Profile
i = //constant
n = //constant
k = //constant
while (i < n){
i*=k;
// Statement(s) that take(s) constant time
}
for (int i=0; i<n; i++){
i*=2;
for (int j=0; j<i; j++){
// Statement(s) that take(s) constant time
}
}
for (int i=0; i<n; i++){
for (int j=0; j<i; j++){
//Statement(s) that take(s) constant time
}
}
for (int i=0; i<n; i++){
for (int j=0; j<m; j++){
//Statement(s) that take(s) constant time
}
}
for (int x = 0; x < n; x+=k) {
//statement(s) that take constant time
}
for (int x=0; x<n ;x++){
//statement(s)thattakeconstanttime
}
@AnasAboreeda
AnasAboreeda / FibonacciHugeTest.java
Last active January 17, 2022 15:08
Testing Fibonacci Number modulo M
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;
class FibonacciHugeTest {
@Test
void getPisanoPeriod() {
assertEquals(8, FibonacciHuge.getPisanoPeriod(3));
@AnasAboreeda
AnasAboreeda / FibonacciHuge.java
Created January 17, 2022 14:37
Fibonacci Number modulo M
import java.math.BigInteger;
import java.util.*;
public class FibonacciHuge {
public static long getFibonacciHugeNaive(long n, long m) {
if (n <= 1) return n;
BigInteger previous = BigInteger.ZERO;
BigInteger current = BigInteger.ONE;
@AnasAboreeda
AnasAboreeda / weather.html
Created December 26, 2021 03:11
weather widget
<html>
<body>
<a class="weatherwidget-io" href="https://forecast7.com/en/52d374d90/amsterdam/" data-label_1="AMSTERDAM" data-label_2="WEATHER" data-theme="original" >AMSTERDAM WEATHER</a>
<script>
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='https://weatherwidget.io/js/widget.min.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','weatherwidget-io-js');
</script>
</body>
</html>

Keybase proof

I hereby claim:

  • I am anasaboureada on github.
  • I am aboureada (https://keybase.io/aboureada) on keybase.
  • I have a public key ASBqGxyu2chZwpNZfKYc0I5Ajn8Rqwdpfv1ye0MNdKtj-Ao

To claim this, I am signing this object: