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
class Node: | |
def __init__(self, val, left=None, right=None): | |
self.val = val | |
self.left = left | |
self.right = right | |
def levelOrderWrong1(root): | |
curr_level = [root] | |
levels = [] |
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
#cython: wraparound=False, boundscheck=False, cdivision=True, overflowcheck=False | |
#cython: profile=False, nonecheck=False, cdivision_warnings=True | |
import numpy as np | |
cimport numpy as np | |
from libc.math import sqrt, exp | |
from sklearn.utils.extmath import fast_dot | |
from sklearn.metrics.pairwise import pairwise_distances | |
def diffusion_map(X, n_components=2, metric="euclidean"): |
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 random | |
import sys | |
from time import sleep | |
from getpass import getpass | |
def main(): | |
n_games = int(sys.argv[1]) | |
print("You have 100 tanks do distrubute between 5 territories.") | |
print("Enter the number of tanks to put in each territory.") | |
print("You may -1 for the territory to auto-select number needed to add to 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 numpy as np | |
def algorithm(cities): | |
best_order = [] | |
best_length = float('inf') | |
for i_start, start in enumerate(cities): | |
order = [i_start] | |
length = 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
cdef DTYPE_t getEpsilon(int xi, DTYPE_t[:,:] RMSD, DTYPE_t[:] epsilonList, DTYPE_t[:] derivativeEpsilonList, int N): | |
cdef DTYPE_t e,k | |
cdef int i,j,x,y,neighborsLength | |
cdef DTYPE_t[:,:] eigenValues=np.zeros((len(derivativeEpsilonList),N), dtype=DTYPE) | |
cdef DTYPE_t[:,:] neighborsMatrix | |
cdef DTYPE_t[:] A | |
for i,e in enumerate(derivativeEpsilonList): | |
neighbors=[] | |
for j in range(N): |
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
""" | |
The code was modified so that you dont have to import any libraries or use external files :) | |
""" | |
import numpy as np | |
import sys | |
#import Bio.PDB | |
#from scipy import linalg | |
from time import clock |