Skip to content

vscala/Python-Snippets

Repository files navigation

Python-Snippets

Useful python algorithms and data structures

Data Strucutres

Subscriptable Set - subscriptableSet.py

Implementation of a set data structure with the additional property of being subscriptable

Trie - trie.py

Implementation of trie data strucutre

Disjoint Set - disjointSet.py

Implementation of disjoint set data strucutre

Graph - graph.py

Implementation of graph data strucutre

Progress bar / percent - progress.py

Functions to create a progress bar or progress percentage

Graph Searching Algorithms - searching.py

  • Iterative BFS (for graph)
  • Iterative DFS (for graph)
  • Dijkstras (for graph)

GCD and LCM using Euclidean Algorithm - euclideanAlgorithm.py

Efficient GCD and LCM using Euclidean Algorithm

Function Performance - performance.py

Decorator to time how long it takes to execute a function

Sequences - sequences.py

  • Sequence of first n consecutive squares
  • Fibonacci sequence
  • Catalan numbers

Partitions - partition.py

Generate all (ordered) partitions of a list

Patience Sorting - patience.py

Algorithm for finding the longest increasing subsequence

About

Useful python algorithms and data structures

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages