This file contains hidden or 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 time | |
from collections import deque | |
import sys | |
sys.setrecursionlimit(10000) | |
class Node(object): | |
def __init__(self, name): | |
self.name = name | |
self.explored = False |
This file contains hidden or 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 time | |
import random | |
import copy | |
# j4f | |
def runtime(func, args): | |
now = time.time() | |
func(args) | |
return time.time() - now |
This file contains hidden or 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
counts = 0 | |
def quicksort(arr): | |
global counts | |
if len(arr) >= 1: | |
counts += len(arr)-1 | |
if len(arr) <= 1: | |
return arr | |
else: |
This file contains hidden or 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 time | |
inv = 0 | |
def mergesort(arr): | |
global inv | |
if len(arr) <= 1: | |
return arr | |
else: |
This file contains hidden or 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 tensorflow.examples.tutorials.mnist import input_data | |
mnist = input_data.read_data_sets('MNIST_data', one_hot=True) | |
def softmax(logits): | |
e = np.exp(logits) | |
return e / np.expand_dims(e.sum(axis=1), axis=1) |
NewerOlder