Skip to content

Instantly share code, notes, and snippets.

View girish3's full-sized avatar
🎯
Focusing

Girish Budhwani girish3

🎯
Focusing
View GitHub Profile
// Go’s syntax is very much like C, you should be fine
// reading it.
// Defining Human type, it has a variable Name of type string.
// (Yes, type is mentioned after variable name)
type Human struct {
Name string
}
// Defining a method GetName on the type Human which
@girish3
girish3 / go_oop2.java
Last active March 25, 2018 17:50
golang oop 2 article snippet
// the example is in Java
class Base {
private int i = 0;
void inc1() {
inc2(); // the change
}
void inc2() {
// the example is in Java
class Base {
private int i = 0;
void inc1() {
i++;
}
void inc2() {
W = "acabacacd"
T = "acfacabacabacacdk"
# this method is from above code snippet.
aux = creatAux(W)
# counter for word W
i = 0
# counter for text T
j = 0
def createAux(W):
# initializing the array aux with 0's
aux = [0] * len(W)
# for index 0, it will always be 0
# so starting from index 1
i = 1
# m can also be viewed as index of first mismatch
m = 0
while i < len(W):
# Here is the working code of the naive approach.
def bruteSearch(W, T):
# edge case check
if W == "":
return -1
# getting the length of the strings
wordLen = len(W)
textLen = len(T)
class DoubleList(object):
head = None
tail = None
size = 0
def append(self, data):
new_node = Node(data)
if self.head is None:
self.head = self.tail = new_node
class DoubleList(object):
head = None
tail = None
size = 0
def append(self, data):
new_node = Node(data)
if self.head is None:
self.head = self.tail = new_node
@girish3
girish3 / avl_tree.py
Created February 15, 2016 18:33
AVL tree implementation in python
#import random, math
outputdebug = False
def debug(msg):
if outputdebug:
print msg
class Node():
def __init__(self, key):
@girish3
girish3 / .gitignore
Last active June 6, 2019 01:28
[gitignore for android project] Taken from Github gitignore repo https://github.com/github/gitignore/blob/master/Android.gitignore #android
# Built application files
*.apk
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class