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
# | |
# Square Root Babylonian Method | |
# @Adrian Statescu | |
# | |
def sqrt_babylonian(n): | |
x = n | |
y = 1.0 | |
eps = 0.000001 | |
while x - y > eps: | |
x = (x + y) / 2 |
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
# | |
# Square Root Babylonian Method | |
# @Adrian Statescu | |
# | |
def sqrt_babylonian(n) | |
x = n | |
y = 1.0 | |
e = 0.000001 | |
while x - y > e | |
x = (x + y) / 2 |
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
#include <stdio.h> | |
#include <malloc.h> | |
typedef struct Node { | |
int data; | |
struct Node *next; | |
} Node; | |
Node *head = NULL; |
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
def make_bold(f): | |
def bold_wrapper(): | |
return "<b>" + f() +"</b>" | |
return bold_wrapper | |
def make_italic(f): | |
def italic_wrapper(): | |
return "<i>" + f() + "</i>" | |
return italic_wrapper |
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
from time import sleep | |
from sys import stdout | |
def printt(string, delay = 0.05): | |
for c in string: | |
stdout.write(c) | |
stdout.flush() | |
sleep(delay) | |
print("") |
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
;to change your directory colors, open up your ~/.bashrc file with your editor | |
;and make the following entry at the end of the | |
LS_COLORS=$LS_COLORS:'di=0;35:' ; export LS_COLORS |
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
#include <stdio.h> | |
#define __repeat__ do | |
#define __until__(COND) while(!(COND)) | |
int isPrime(int n) { | |
if( n == 0 || n == 1 ) return 0; | |
if( n == 2 || n == 3 ) return 1; | |
int i = 2, |
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
def euclid_it a, b | |
while b != 0 | |
r = a % b | |
a, b = b, r | |
end | |
a | |
end | |
def euclid_rec a, b | |
if b == 0 |
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
import sys | |
def _euclid(a,b): | |
if(b==0): | |
return a | |
else: | |
return _euclid(b,a%b) | |
def _euclid_it(a,b): | |
while(b): | |
r = a % b |
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
#include <stdio.h> | |
#include <malloc.h> | |
#define FIN "ssm.in" | |
#define FOUT "ssm.out" | |
struct Arr { | |
int size; | |
int *data; | |
}; | |