Create sos.py

Contains Algorithms 1 and 2 (not randomly tested)