From ba3e4b47c45300557f4bcb3bde85205176136537 Mon Sep 17 00:00:00 2001 From: Ardelean Eugen-Richard <37302327+ArdeleanRichard@users.noreply.github.com> Date: Fri, 2 Aug 2019 23:41:32 +0300 Subject: [PATCH] Create stalin_sort.pl --- prolog/stalin_sort.pl | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 prolog/stalin_sort.pl diff --git a/prolog/stalin_sort.pl b/prolog/stalin_sort.pl new file mode 100644 index 0000000..c554f08 --- /dev/null +++ b/prolog/stalin_sort.pl @@ -0,0 +1,5 @@ +stalinSortAux([], _, []). +stalinSortAux([H1|T1], [H2|T2], [H1|R]):- H1>H2, !, stalinSortAux(T1, T2, R). +stalinSortAux([_|T1], [H2|T2], R):- stalinSortAux(T1, [H2|T2], R). + +stalinSort([H|T], [H|R]):- stalinSortAux(T, [H|T], R).