(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import time | |
| import random | |
| import requests | |
| EN_URL = 'http://www.simsimi.com/func/req?lc=en&msg=' | |
| ZH_URL = 'http://www.simsimi.com/func/req?lc=ch&msg=' |
| var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5] | |
| func partition(v: Int[], left: Int, right: Int) -> Int { | |
| var i = left | |
| for j in (left + 1)..(right + 1) { | |
| if v[j] < v[left] { | |
| i += 1 | |
| (v[i], v[j]) = (v[j], v[i]) | |
| } | |
| } |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.