def qsort[A <% Ordered[A]](v: Seq[A]): Seq[A] = v.headOption match {
case Some(x) => (qsort(v.tail.filter(_ < x)) :+ x) ++ qsort(v.tail.filter(_ >= x))
case _ => Seq()
}
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)