Python codes (data structures, algorithms)