Skip to content

Instantly share code, notes, and snippets.

View vansjyo's full-sized avatar
🏠
Working from home

Vanshika Gupta vansjyo

🏠
Working from home
View GitHub Profile
@karpathy
karpathy / min-char-rnn.py
Last active May 4, 2024 17:44
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@ashleyholman
ashleyholman / algo_q3.cpp
Created February 25, 2013 12:20
This is an implementation of Karger's Min Cut algorithm. The probability of any given attempt successfully finding the min cut is lower bounded by P >= 1/n^2. So, n^2*log(n) attempts are made which makes the overall probability of failure P <= 1/n. In practice, this does way more attempts than required to find the min cut on most graphs. On a te…
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <cmath>
struct Vertex;
struct Edge {
int v1;