Skip to content
{{ message }}

Instantly share code, notes, and snippets.

# Anirudh Jayaraman anirudhjayaraman

🏠
Working from home
Created Jul 28, 2016
Python Implementation of Undirected Graphs (Adjacency List and Adjacency Matrix)
View graphUndirected.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created Jul 22, 2016
Deterministic Selection (Median of Medians) Algorithm
View DSelect.py
 def merge_tuple(a,b): """ Function to merge two arrays of tuples """ c = [] while len(a) != 0 and len(b) != 0: if a < b: c.append(a) a.remove(a) else: c.append(b) b.remove(b)
Created Jul 19, 2016
Linear Regression in scikit learn
View linear_regression.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created Jul 18, 2016
KNN algorithm implemented with scikit learn
View knn.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created Jul 18, 2016
Randomized Selection Algorithm
View RSelect.py
 from random import randrange def partition(x, pivot_index = 0): i = 0 if pivot_index !=0: x,x[pivot_index] = x[pivot_index],x for j in range(len(x)-1): if x[j+1] < x: x[j+1],x[i+1] = x[i+1],x[j+1] i += 1 x,x[i] = x[i],x
Created Jul 13, 2016
Computing Work Done (Total Comparisons) by Quick Sort
View countComparisons.py
 #!/usr/bin/env # Case I # First element of the unsorted array is chosen as pivot element for sorting using Quick Sort def countComparisonsWithFirst(x): """ Counts number of comparisons while using Quick Sort with first element of unsorted array as pivot """ global count_pivot_first if len(x) == 1 or len(x) == 0:
Created Jul 12, 2016
Integer list to sort using Quick Sort (Exercise)
View QuickSort_List.txt
 2148 9058 7742 3153 6324 609 7628 5469 7017 504
Last active Feb 3, 2021
Python code for the Quick Sort Algorithm
View quicksort.py
 def quicksort(x): if len(x) == 1 or len(x) == 0: return x else: pivot = x i = 0 for j in range(len(x)-1): if x[j+1] < pivot: x[j+1],x[i+1] = x[i+1], x[j+1] i += 1
Created May 15, 2016
Frankel Wei Regression for 2010-2016
View FrankelWei_2010_2016.r
 ## if fxregime is absent from installed packages, download it and load it if(!require('fxregime')){ install.packages("fxregime") } ## load package library("fxregime") # load the necessary data related to exchange rates - 'FXRatesCHF' # this dataset treats CHF as unit currency # install / load Quandl
Last active May 15, 2016
Auto-detecting Structural Breaks in China’s FX Regime
View FrankelWei_2005_2010.r
 ## if fxregime or strucchange package is absent from installed packages, download it and load it if(!require('fxregime')){ install.packages("fxregime") } if(!require('strucchange')){ install.packages("strucchange") } ## load packages library("fxregime")