Skip to content

Instantly share code, notes, and snippets.

Chuancong Gao chuanconggao

Block or report user

Report or block chuanconggao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
chuanconggao /
Last active Nov 5, 2018
The original minimal 15 lines implementation of PrefixSpan. Full library at
from collections import defaultdict
def frequent_rec(patt, mdb):
results.append((len(mdb), patt))
occurs = defaultdict(list)
for (i, startpos) in mdb:
seq = db[i]
for j in range(startpos + 1, len(seq)):
l = occurs[seq[j]]
chuanconggao /
Last active Mar 8, 2018 — forked from jMuzsik/
Code for computing anagrams that works on both string and list.
def anagrams(s):
return [s] if len(s) == 0 else [
w[:pos] + s[:1] + w[pos:]
for w in anagrams(s[1:])
for pos in range(len(w) + 1)
# returns ['abc', 'bac', 'bca', 'acb', 'cab', 'cba']
You can’t perform that action at this time.