Algorithm

Introduction to Algorithms

Visualization to learn

Visualize code to Learn

cxyxiaowu

Time Complexity Running time of binary search

Github

h2pl

Java

小码哥《恋上数据结构与算法》笔记

Decorator Fibonacci


class MyCache(object):
    def __init__(self, func):
        self.func = func
        self.cache = {}
        print(f'In MyCache __init__ {func.__name__}')
    
    def __call__(self, *args):
        if not args in self.cache:
            self.cache[args] = self.func(*args)
        return self.cache[args]

@MyCache
def fib(n):
    if n <=1: return 1
    return fib(n - 1) + fib(n - 2)

print(fib(33))

Divide and Conquer

Maximum Subarray Sum using Divide and Conquer algorithm

Print all shortest paths between given source and destination in an undirected graph

Graph