Skip to content

Instantly share code, notes, and snippets.

@ayulockin
ayulockin / linkedListStack.py
Created August 8, 2019 15:49
Stack Implementation Using Linked List
class LinkedStack:
def __init__(self):
self._head = None
self._size = 0
class _node:
__slots__ = '_element', '_nextP'
def __init__(self, element, nextP):
self._element = element
def quicksort(S):
if len(S)<2:
print("[RETURNED]length of list less than 2")
return
pivot = S[-1]
print("[INFO] pivot: ", pivot)
L = []
G = []
@ayulockin
ayulockin / understanding_mergesort.py
Last active July 25, 2019 15:14
Understanding MergeSort :D
## DIVIDE -> mergesort
## CONQUER -> mergesort
## COMBINE -> merge
def merge(S1, S2, S):
'''
S1-> First sorted seq
S2-> Second sorted seq
S -> Original seq
'''
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ayulockin
ayulockin / docScanner.py
Created December 25, 2018 08:33
Code to implemet a basic document scanner
import cv2
from scipy.spatial import distance as dist
import numpy as np
def resize(image, width=None, height=None, inter=cv2.INTER_AREA):
dim = None
(h, w) = image.shape[:2]
# check to see if the width is None
if width is None: