Skip to content

Instantly share code, notes, and snippets.

Denis Papathanasiou dpapathanasiou

Block or report user

Report or block dpapathanasiou

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
View breadth_first_search.py
#!/usr/bin/env python
"""
A breadth-first search implementation from:
"MIT Open CourseWare: Introduction to Algorithms"
Lecture 13: Breadth-First Search
https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/lecture-13-breadth-first-search-bfs/
View depth_first_search.py
#!/usr/bin/env python
"""
An iterative implementation of depth-first search from:
"Python Algorithms: Mastering Basic Algorithms in the Python Language"
by Magnus Lie Hetland
ISBN: 9781484200551
View sliding_window.py
#!/usr/bin/env python
"""
An implementation of the "sliding window" technique to find shortest matching subarrays, inspired by:
https://leetcode.com/problems/find-all-anagrams-in-a-string/discuss/92007/sliding-window-algorithm-template-to-solve-all-the-leetcode-substring-search-problem
"""
from sys import maxint
@dpapathanasiou
dpapathanasiou / bellman_ford.py
Created Apr 20, 2019
Bellman Ford Algorithm
View bellman_ford.py
#!/usr/bin/env python
"""
An implementation of the Bellman-Form algorithm from:
"Python Algorithms: Mastering Basic Algorithms in the Python Language"
by Magnus Lie Hetland
ISBN: 9781484200551
@dpapathanasiou
dpapathanasiou / breadth_first_search.py
Created Apr 2, 2019
Breadth-First Search in Python
View breadth_first_search.py
#!/usr/bin/env python
"""
A breadth-first search implementation from:
"Python Algorithms: Mastering Basic Algorithms in the Python Language"
by Magnus Lie Hetland
ISBN: 9781484200551
View quicksort.py
#!/usr/bin/env python
"""
An implementation in python, inspired by the version in "Learn You
a Haskell for Great Good!"
(http://learnyouahaskell.com/recursion#quick-sort)
"""
def quicksort (a):
@dpapathanasiou
dpapathanasiou / mergesort.py
Created Mar 25, 2019
Merge Sort in Python
View mergesort.py
#!/usr/bin/env python
"""
An implementation in python, inspired by the haskell version via
Cormen
(https://github.com/dpapathanasiou/algorithms-unlocked-haskell/blob/master/algorithms-for-sorting-and-searching/MergeSort.hs)
"""
def merge (a, b, c=[]):
@dpapathanasiou
dpapathanasiou / HOWTO.md
Created Nov 4, 2018
How to connect to a USB Armory via ssh on linux
View HOWTO.md

Based on the Host communication instructions, but with a tweak for when the usb0 address is not found:

$ /sbin/ip link set usb0 up
Cannot find device "usb0"

Because of the predictable network interface name scheme, though, usb0 may be renamed to something else:

@dpapathanasiou
dpapathanasiou / trie.py
Last active Feb 23, 2019
Ternary Search Tree in python
View trie.py
#!/usr/bin/env python
"""
A ternary search tree implementation, inspired by:
http://www.drdobbs.com/database/ternary-search-trees/184410528 and
https://lukaszwrobel.pl/blog/ternary-search-tree/
https://github.com/djtrack16/tst/blob/master/ternarysearchtree.py
"""
@dpapathanasiou
dpapathanasiou / binary_search_tree.py
Last active Mar 31, 2019
Binary Search Tree in Python
View binary_search_tree.py
#!/usr/bin/env python
"""
A binary search tree implementation, from:
"Python Algorithms: Mastering Basic Algorithms in the Python Language"
by Magnus Lie Hetland
ISBN: 9781484200551
You can’t perform that action at this time.