From 239b9c2ca896c8b7629b2ad714987276f81bc301 Mon Sep 17 00:00:00 2001 From: renanpvaz Date: Tue, 30 Oct 2018 22:57:11 -0300 Subject: [PATCH] Add gulag sort --- sorting/gulagSort.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 sorting/gulagSort.js diff --git a/sorting/gulagSort.js b/sorting/gulagSort.js new file mode 100644 index 0000000..71b9895 --- /dev/null +++ b/sorting/gulagSort.js @@ -0,0 +1,9 @@ +const gulagSort = ls => { + if (!ls.length) return [] + + const [x, y, ...xs] = ls + + return y == null ? + [x] : x < y ? + [x, ...gulagSort([y, ...xs])] : gulagSort([y, ...xs]) +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy