This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
func quickSort(ls:[Int]) -> [Int] | |
{ | |
guard ls.count > 1 else { return ls } | |
let pivot = ls[ls.count/2] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
My attempt at Dijkstra Algorithm | |
https://www.youtube.com/watch?v=0nVYi3o161A | |
https://www.youtube.com/watch?v=5GT5hYzjNoo | |
*/ | |
import UIKit | |
class Node : CustomDebugStringConvertible, Hashable, Equatable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0xF58b65CB859e4f113F639864Bb8D779b34084aFc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.topConstraint.constant = 0.0 | |
UIView.animateWithDuration(2, delay: 1, options: UIViewAnimationOptions.CurveEaseInOut, animations: { | |
CATransaction.begin() | |
CATransaction.setValue(2, forKey: "kCATransactionAnimationDuration") | |
let f = CAMediaTimingFunction(controlPoints: 0.43, 0, 0.57, 1) //quad ease in out | |
CATransaction.setAnimationTimingFunction(f) | |
self.view.layoutIfNeeded() | |
CATransaction.commit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array_size:Int = 6 | |
let input:[Float] = [1,2,3,4,5,6] | |
var output = [Float](count: array_size, repeatedValue: 0.0) | |
vDSP_vsmul(input, 1, [5], &output, 5, vDSP_Length(array_size)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Fib { | |
var current: Int = 1; | |
var last: Int = 0; | |
mutating func next() { | |
let tmp = current; | |
current += last; | |
last = tmp; | |
print("Current: \(current) Last: \(last) "); |
NewerOlder