Skip to content

Instantly share code, notes, and snippets.

View jknair0's full-sized avatar
🌴
Not On vacation

JayaKrishnan Nair K jknair0

🌴
Not On vacation
View GitHub Profile
// https://www.cs.cmu.edu/~15451-f18/lectures/lec19-DFS-strong-components.pdf
import java.util.*;
class Graph {
ArrayList<Integer>[] graph;
public Graph(int n) {
graph = new ArrayList[n];
// https://www.cs.cmu.edu/~15451-f18/lectures/lec19-DFS-strong-components.pdf
import java.util.*;
class Graph {
ArrayList<Integer>[] graph;
public Graph(int n) {
graph = new ArrayList[n];
// https://www.cs.cmu.edu/~15451-f18/lectures/lec19-DFS-strong-components.pdf
import java.util.*;
class Graph {
ArrayList<Integer>[] graph;
public Graph(int n) {
graph = new ArrayList[n];
/*
* Copyright (c) 2021 JayaKrishnan Nair K
* All rights reserved.
*/
package tech.jknair.uibase.utils
import kotlin.properties.ObservableProperty
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
import matplotlib.pyplot as plt
from matplotlib import animation, rc
rc('animation', html='html5')
def calculateY(x, W, b):
return x * W + b
def calculate_all_predictions(x, W, b):
return list(map(lambda xx: calculateY(xx, W, b), x))
@jknair0
jknair0 / QuickSort.java
Created January 5, 2020 05:16
QuickSort
import java.util.Arrays;
class QuickSort {
public static void main(String[] args) {
QuickSort quickSort = new QuickSort();
int[] input = new int[]{
26690, 701, 126, 248845, 17,
54016, 71347, 99457, 134932,
1754, 2241, 2957, 3732, 4,
@jknair0
jknair0 / BinarySearch.java
Last active January 4, 2020 05:39
binary search which returns index of found value.
import java.util.Arrays;
class BinarySearch {
public int search(int[] input, int searchInput) {
int n = input.length;
if (n == 0) {
return -1;
}
int midPoint = n / 2;

Keybase proof

I hereby claim:

  • I am kjknair on github.
  • I am jknair (https://keybase.io/jknair) on keybase.
  • I have a public key ASBEVlDN-djwPyaPhvpBe5JsEgQVuFkWQgIN_RxJCWNTPQo

To claim this, I am signing this object:

@jknair0
jknair0 / setup-git-pre-commit-hook.sh
Created October 8, 2019 12:41
script to run before using .githooks folder as primary hooks folder to share between teams
#!/bin/bash
git config core.hooksPath .githooks
chmod +x ./.githooks/*
echo "Successfully added git-hooks!"
@jknair0
jknair0 / mvi_dependencies.md
Last active September 29, 2019 10:59
dependencies used personally for mvi
implementation 'io.reactivex.rxjava3:rxjava:3.0.0-RC3'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.