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 pow(x,n): | |
if n==0: return 1 | |
if n==1: return x | |
res = x | |
i = 2 | |
while i<= n : | |
if 2*i < n: | |
res = res * res | |
res = res * x | |
i = i + 1 |
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 insert(list,x): | |
low = 0 | |
high = len(list) - 1 | |
i = (low+high)//2 | |
while low < high and not (list[i] <= x and list[i+1] > x): | |
if list[i] < x: | |
low = i + 1 | |
i = (low+high)//2 | |
else: | |
high = i - 1 |
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
assume cs:code, ds:data | |
data segment | |
original dd 12A63478h | |
dd 12345678h | |
dd 1A2B3C4dh | |
dd 0FEDC9876h | |
lungime db (lungime-original)/4 | |
ranks db 10 DUP(?) | |
suma dw 0 | |
contor db 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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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 copy | |
def next_state(current_state, nr_neighbors): | |
if (current_state and (nr_neighbors < 2 or nr_neighbors > 3)) or\ | |
(not current_state and nr_neighbors == 3): | |
return not current_state | |
return current_state | |
def are_neighbors(cell1,cell2): | |
return abs(cell1[0] - cell2[0]) <= 1 and abs(cell1[1] - cell2[1]) <= 1 \ | |
and cell1 != cell2 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 multiprocessing import Pool | |
__author__ = 'Roland' | |
from PIL import Image | |
#size of image | |
imgx = 600 | |
imgy = 400 | |
#make image buffer | |
image = Image.new("RGB", (imgx, imgy)) |
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
(defun inserare(el l) | |
(cond | |
((null l) nil) | |
(t (mapcar (lambda (x) (cons el x)) l)) | |
) | |
) | |
(defun permutare(l) | |
(cond | |
((null l) '(())) |
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
__author__ = 'Roland' | |
import copy | |
class avl: | |
def __init__(self,value = None,left = None,right = None,parent = None): | |
self.value = value | |
self.left = left | |
self.right = right | |
self.parent = parent |
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 numpy as np | |
from numpy.random import random as rand | |
class NeuralNetwork: | |
activations = { | |
'tanh': lambda x: np.tanh(x), | |
'relu': lambda x: np.clip(x, 0, np.max(x)) | |
} | |
derivatives = { |
OlderNewer