From 384d3c501a38b489312496b0bf9522bdf29053d8 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Mon, 14 Dec 2015 13:57:29 +0100 Subject: Add Slovenian translations for Prolog exercises --- .../license_plates/checklicenseplate_3/sl.py | 18 ++++++++++++++++++ prolog/problems/license_plates/firstminus_2/sl.py | 14 ++++++++++++++ prolog/problems/license_plates/genexp_2/sl.py | 19 +++++++++++++++++++ prolog/problems/license_plates/getdigits_2/sl.py | 13 +++++++++++++ prolog/problems/license_plates/joindigits_2/sl.py | 16 ++++++++++++++++ prolog/problems/lists/conc_3/sl.py | 15 +++++++++++++++ prolog/problems/lists/count_3/sl.py | 13 +++++++++++++ prolog/problems/lists/del_3/sl.py | 20 ++++++++++++++++++++ prolog/problems/lists/divide_3/sl.py | 15 +++++++++++++++ prolog/problems/lists/dup_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py | 18 ++++++++++++++++++ prolog/problems/lists/insert_3/sl.py | 15 +++++++++++++++ prolog/problems/lists/len_2/sl.py | 13 +++++++++++++ prolog/problems/lists/max_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/memb_2/sl.py | 17 +++++++++++++++++ prolog/problems/lists/min_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/palindrome_1/sl.py | 15 +++++++++++++++ prolog/problems/lists/permute_2/sl.py | 18 ++++++++++++++++++ prolog/problems/lists/rev_2/en.py | 4 ++-- prolog/problems/lists/rev_2/sl.py | 15 +++++++++++++++ prolog/problems/lists/shiftleft_2/sl.py | 13 +++++++++++++ prolog/problems/lists/shiftright_2/sl.py | 13 +++++++++++++ prolog/problems/lists/sublist_2/sl.py | 19 +++++++++++++++++++ prolog/problems/lists/sum_2/sl.py | 13 +++++++++++++ prolog/problems/sets/diff_3/sl.py | 13 +++++++++++++ prolog/problems/sets/intersect_3/sl.py | 13 +++++++++++++ prolog/problems/sets/is_subset_2/sl.py | 15 +++++++++++++++ prolog/problems/sets/is_superset_2/sl.py | 15 +++++++++++++++ prolog/problems/sets/powerset_2/sl.py | 13 +++++++++++++ prolog/problems/sets/subset_2/sl.py | 20 ++++++++++++++++++++ prolog/problems/sets/union_3/sl.py | 13 +++++++++++++ prolog/problems/sorting/is_sorted_1/sl.py | 15 +++++++++++++++ prolog/problems/sorting/isort_2/sl.py | 13 +++++++++++++ prolog/problems/sorting/pivoting_4/sl.py | 13 +++++++++++++ prolog/problems/sorting/quick_sort_2/sl.py | 13 +++++++++++++ prolog/problems/sorting/sins_3/sl.py | 15 +++++++++++++++ prolog/problems/sorting/slowest_sort_ever_2/sl.py | 13 +++++++++++++ 37 files changed, 543 insertions(+), 2 deletions(-) create mode 100644 prolog/problems/license_plates/checklicenseplate_3/sl.py create mode 100644 prolog/problems/license_plates/firstminus_2/sl.py create mode 100644 prolog/problems/license_plates/genexp_2/sl.py create mode 100644 prolog/problems/license_plates/getdigits_2/sl.py create mode 100644 prolog/problems/license_plates/joindigits_2/sl.py create mode 100644 prolog/problems/lists/conc_3/sl.py create mode 100644 prolog/problems/lists/count_3/sl.py create mode 100644 prolog/problems/lists/del_3/sl.py create mode 100644 prolog/problems/lists/divide_3/sl.py create mode 100644 prolog/problems/lists/dup_2/sl.py create mode 100644 prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py create mode 100644 prolog/problems/lists/insert_3/sl.py create mode 100644 prolog/problems/lists/len_2/sl.py create mode 100644 prolog/problems/lists/max_2/sl.py create mode 100644 prolog/problems/lists/memb_2/sl.py create mode 100644 prolog/problems/lists/min_2/sl.py create mode 100644 prolog/problems/lists/palindrome_1/sl.py create mode 100644 prolog/problems/lists/permute_2/sl.py create mode 100644 prolog/problems/lists/rev_2/sl.py create mode 100644 prolog/problems/lists/shiftleft_2/sl.py create mode 100644 prolog/problems/lists/shiftright_2/sl.py create mode 100644 prolog/problems/lists/sublist_2/sl.py create mode 100644 prolog/problems/lists/sum_2/sl.py create mode 100644 prolog/problems/sets/diff_3/sl.py create mode 100644 prolog/problems/sets/intersect_3/sl.py create mode 100644 prolog/problems/sets/is_subset_2/sl.py create mode 100644 prolog/problems/sets/is_superset_2/sl.py create mode 100644 prolog/problems/sets/powerset_2/sl.py create mode 100644 prolog/problems/sets/subset_2/sl.py create mode 100644 prolog/problems/sets/union_3/sl.py create mode 100644 prolog/problems/sorting/is_sorted_1/sl.py create mode 100644 prolog/problems/sorting/isort_2/sl.py create mode 100644 prolog/problems/sorting/pivoting_4/sl.py create mode 100644 prolog/problems/sorting/quick_sort_2/sl.py create mode 100644 prolog/problems/sorting/sins_3/sl.py create mode 100644 prolog/problems/sorting/slowest_sort_ever_2/sl.py (limited to 'prolog') diff --git a/prolog/problems/license_plates/checklicenseplate_3/sl.py b/prolog/problems/license_plates/checklicenseplate_3/sl.py new file mode 100644 index 0000000..2e3ec65 --- /dev/null +++ b/prolog/problems/license_plates/checklicenseplate_3/sl.py @@ -0,0 +1,18 @@ +# coding=utf-8 + +name = 'checkLicensePlate/3' +slug = 'Preveri, če lahko iz številk v registrski tablici sestaviš veljavno enačbo' + +description = '''\ +

checkLicensePlate(LP, E1, E2): iz cifer v seznamu LP se da sestaviti veljavno enačbo E1 = E2. E1 in E2 sta aritmetična izraza, sestavljena iz podseznamov Plate z uporabo aritmetičnih operatorjev (+, -, * and /). Dodaten unarni minus se lahko vstavi na začetek izrazov E1 in E2.

+
+  ?- checkLicensePlate([l,j,l,3,-,2,1,7], E1, E2).
+    E1 = 3,       E2 = 21/7 ;
+    E1 = -3,      E2 = -21/7 ;
+    E1 = 3*2,     E2 = -1+7 ;
+    E1 = -3*2,    E2 = 1-7 ;
+    E1 = 3*2+1,   E2 = 7 ;
+    E1 = -3*2-1,  E2 = -7.
+
''' + +hint = {} diff --git a/prolog/problems/license_plates/firstminus_2/sl.py b/prolog/problems/license_plates/firstminus_2/sl.py new file mode 100644 index 0000000..d480994 --- /dev/null +++ b/prolog/problems/license_plates/firstminus_2/sl.py @@ -0,0 +1,14 @@ +# coding=utf-8 + +name = 'firstMinus/2' +slug = 'Negiraj prvi element v danem seznamu števil' + +description = '''\ +

firstMinus(L1, L2): seznam L2 je enak kot L1, razen prvega elementa, ki je lahko negiran ali pa ne. Predikat naj vrne obe rešitvi, eno za drugo.

+
+  ?- firstMinus([1,2,3], L).
+    L = [1,2,3] ;
+    L = [-1,2,3].
+
''' + +hint = {} diff --git a/prolog/problems/license_plates/genexp_2/sl.py b/prolog/problems/license_plates/genexp_2/sl.py new file mode 100644 index 0000000..9160f27 --- /dev/null +++ b/prolog/problems/license_plates/genexp_2/sl.py @@ -0,0 +1,19 @@ +# coding=utf-8 + +name = 'genexp/2' +slug = 'Sestavi aritmetični izraz iz številk v podanem seznamu' + +description = '''\ +

genexp(L, E): Izraz E je zgrajen iz številk v seznamu L z dodajanjem aritmetičnih operatorjev. Predikat naj vrača vse možne izraze, enega po enega.

+
+  ?- genexp([1,2,3], L).
+    L = 1+2+3 ;
+    L = 1+2-3 ;
+    L = (1+2)*3 ;
+    L = (1+2)/3 ;
+    L = 1-2+3 ;
+    L = 1-2-3 ;
+    ...
+
''' + +hint = {} diff --git a/prolog/problems/license_plates/getdigits_2/sl.py b/prolog/problems/license_plates/getdigits_2/sl.py new file mode 100644 index 0000000..3f59e90 --- /dev/null +++ b/prolog/problems/license_plates/getdigits_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'getdigits/2' +slug = 'Vrni vse številke iz podanega seznama' + +description = '''\ +

getdigits(L, DL): seznam DL vsebuje vse številke iz seznama L, vrstni red elementov se ohrani.

+
+  ?- getdigits([2,3,e,-,4,b], DL).
+    DL = [2,3,4].
+
''' + +hint = {} diff --git a/prolog/problems/license_plates/joindigits_2/sl.py b/prolog/problems/license_plates/joindigits_2/sl.py new file mode 100644 index 0000000..344d849 --- /dev/null +++ b/prolog/problems/license_plates/joindigits_2/sl.py @@ -0,0 +1,16 @@ +# coding=utf-8 + +name = 'joindigits/2' +slug = 'Združi sosednja števila v seznamu na vse možne načine' + +description = '''\ +

joindigits(L, NL): seznam NL dobimo iz seznama L tako, da poljubno združujemo sosednja števila. Predikat naj vrača vse možnosti, eno po eno.

+
+  ?- joindigits([3,2,4], NL).
+    NL = [324] ;
+    NL = [32,4] ;
+    NL = [3,24] ;
+    NL = [3,2,4].
+
''' + +hint = {} diff --git a/prolog/problems/lists/conc_3/sl.py b/prolog/problems/lists/conc_3/sl.py new file mode 100644 index 0000000..15e3163 --- /dev/null +++ b/prolog/problems/lists/conc_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'conc/3' +slug = 'Združi dva seznama (konkatenacija)' + +description = '''\ +

conc(L1, L2, L): seznam L dobiš tako, da seznamu L1 na konec dodaš elemente seznama L2.

+
+  ?- conc([1,2], [3,4], X).
+    X = [1,2,3,4].
+  ?- conc(X, [], [1,2,3]).
+    X = [1,2,3].
+
''' + +hint = {} diff --git a/prolog/problems/lists/count_3/sl.py b/prolog/problems/lists/count_3/sl.py new file mode 100644 index 0000000..15a4650 --- /dev/null +++ b/prolog/problems/lists/count_3/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'count/3' +slug = 'Preštej kolikokrat se element pojavi v seznamu' + +description = '''\ +

count(X, L, N): N je število kolikokrat se element X pojavi v seznamu L.

+
+  ?- count(1, [1,2,1,3,1], N).
+    N = 3.
+
''' + +hint = {} diff --git a/prolog/problems/lists/del_3/sl.py b/prolog/problems/lists/del_3/sl.py new file mode 100644 index 0000000..49ab16f --- /dev/null +++ b/prolog/problems/lists/del_3/sl.py @@ -0,0 +1,20 @@ +# coding=utf-8 + +name = 'del/3' +slug = 'Zbriši element iz seznama' + +description = '''\ +

del(X, L1, L2): seznam L2 dobimo iz seznama L1 tako da zbrišemo element X.

+
+  ?- del(1, [1,2,3], L).
+    L = [2,3].
+  ?- del(2, [1,2,3,2,5], L).
+    L = [1,3,2,5] ;
+    L = [1,2,3,5].
+  ?- del(X, [1,2,3], L).
+    X = 1, L = [2,3] ;
+    X = 2, L = [1,3] ;
+    X = 3, L = [1,2].
+
''' + +hint = {} diff --git a/prolog/problems/lists/divide_3/sl.py b/prolog/problems/lists/divide_3/sl.py new file mode 100644 index 0000000..ecf9a5a --- /dev/null +++ b/prolog/problems/lists/divide_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'divide/3' +slug = 'Razdeli dani seznam na dva podseznama (približno) enake velikosti' + +description = '''\ +

divide(L, L1, L2): seznam L1 vsebuje elemente na lihih pozicijah v seznamu L, seznam L2 pa elemente na sodih pozicijah v L.

+
+  ?- divide([a,b,c,d,e,f,g], X, Y).
+    X = [a,c,e,g], Y = [b,d,f].
+  ?- divide([a,b,c,d,e,f], X, Y).
+    X = [a,c,e], Y = [b,d,f].
+
''' + +hint = {} diff --git a/prolog/problems/lists/dup_2/sl.py b/prolog/problems/lists/dup_2/sl.py new file mode 100644 index 0000000..fc974d8 --- /dev/null +++ b/prolog/problems/lists/dup_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'dup/2' +slug = 'Podvoji vse elemente v seznamu' + +description = '''\ +

dup(L1, L2): seznam L2 dobimo iz L1 tako, da podvojimo vsak element.

+
+  ?- dup([1,2], X).
+    X = [1,1,2,2].
+  ?- dup([1,2,3], X).
+    X = [1,1,2,2,3,3].
+
''' + +hint = {} diff --git a/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py new file mode 100644 index 0000000..1959877 --- /dev/null +++ b/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py @@ -0,0 +1,18 @@ +# coding=utf-8 + +name = 'evenlen/1 + oddlen/1' +slug = 'Brez aritmetike preveri, če je seznam sode ali lihe dolžine' + +description = '''\ +

evenlen(L): seznam L ima sodo število elementov.
+oddlen(L): seznam L ima liho število elementov.

+
+  ?- oddlen([1,2,3,4,5]).
+    true.
+  ?- oddlen([1,2,3,4]).
+    false.
+  ?- evenlen([1,2,3,4]).
+    true.
+
''' + +hint = {} diff --git a/prolog/problems/lists/insert_3/sl.py b/prolog/problems/lists/insert_3/sl.py new file mode 100644 index 0000000..08ffced --- /dev/null +++ b/prolog/problems/lists/insert_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'insert/3' +slug = 'Vstavi element na poljubno mesto v seznamu' + +description = '''\ +

insert(X, L1, L2): seznam L2 dobimo iz L1 tako, da vstavimo element X na poljubno mesto. Predikat naj vrne vse možne rešitve, eno za drugo.

+
+  ?- insert(1, [2,3], L).
+    L = [1,2,3] ;
+    L = [2,1,3] ;
+    L = [2,3,1].
+
''' + +hint = {} diff --git a/prolog/problems/lists/len_2/sl.py b/prolog/problems/lists/len_2/sl.py new file mode 100644 index 0000000..5b9f05a --- /dev/null +++ b/prolog/problems/lists/len_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'len/2' +slug = 'Izračunaj dolžino danega seznama' + +description = '''\ +

len(L, Len): Len je dolžina seznama L.

+
+  ?- len([1,2,3], Len).
+    Len = 3.
+
''' + +hint = {} diff --git a/prolog/problems/lists/max_2/sl.py b/prolog/problems/lists/max_2/sl.py new file mode 100644 index 0000000..81c354b --- /dev/null +++ b/prolog/problems/lists/max_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'max/2' +slug = 'Poišči največji element v danem seznamu' + +description = '''\ +

max(L, Max): Max je največji element v seznamu L.

+
+  ?- max([5,4,1,6], M).
+    M = 6.
+  ?- max([3,2,2], M).
+    M = 3.
+
''' + +hint = {} diff --git a/prolog/problems/lists/memb_2/sl.py b/prolog/problems/lists/memb_2/sl.py new file mode 100644 index 0000000..540394b --- /dev/null +++ b/prolog/problems/lists/memb_2/sl.py @@ -0,0 +1,17 @@ +# coding=utf-8 + +name = 'memb/2' +slug = 'Preveri (poišči), če je dani element v seznamu' + +description = '''\ +

memb(E, L): E je element seznama L.

+
+  ?- memb(X, [1,2,3]).
+    X = 1 ;
+    X = 2 ;
+    X = 3.
+  ?- memb(1, [3,2,X]).
+    X = 1.
+
''' + +hint = {} diff --git a/prolog/problems/lists/min_2/sl.py b/prolog/problems/lists/min_2/sl.py new file mode 100644 index 0000000..6a5964b --- /dev/null +++ b/prolog/problems/lists/min_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'min/2' +slug = 'Poišči najmanjši element v danem seznamu' + +description = '''\ +

min(L, Min): Min je najmanjši element v seznamu L.

+
+  ?- min([5,4,1,6], M).
+    M = 1.
+  ?- min([3,2,2], M).
+    M = 2.
+
''' + +hint = {} diff --git a/prolog/problems/lists/palindrome_1/sl.py b/prolog/problems/lists/palindrome_1/sl.py new file mode 100644 index 0000000..04f1f59 --- /dev/null +++ b/prolog/problems/lists/palindrome_1/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'palindrome/1' +slug = 'Preveri, če elementi seznama tvorijo palindrom' + +description = '''\ +

palindrome(L): Elementi seznama L se preberejo v istem vrstnem redu z začetka in s konca seznama.

+
+  ?- palindrome([1,2,3,2,1]).
+    true.
+  ?- palindrome([1,2,3]).
+    false.
+
''' + +hint = {} diff --git a/prolog/problems/lists/permute_2/sl.py b/prolog/problems/lists/permute_2/sl.py new file mode 100644 index 0000000..2c98340 --- /dev/null +++ b/prolog/problems/lists/permute_2/sl.py @@ -0,0 +1,18 @@ +# coding=utf-8 + +name = 'permute/2' +slug = 'Generiraj permutacije elementov v seznamu' + +description = '''\ +

permute(L1, L2): seznam L2 je permutacija vrstnega reda elementov v seznamu L1.

+
+  ?- permute([1,2,3], L).
+    L = [1,2,3] ;
+    L = [1,3,2] ;
+    L = [2,1,3] ;
+    L = [2,3,1] ;
+    L = [3,1,2] ;
+    L = [3,2,1].
+
''' + +hint = {} diff --git a/prolog/problems/lists/rev_2/en.py b/prolog/problems/lists/rev_2/en.py index fe36ec5..7941f9e 100644 --- a/prolog/problems/lists/rev_2/en.py +++ b/prolog/problems/lists/rev_2/en.py @@ -6,10 +6,10 @@ slug = 'reverse a list' description = '''\

rev(L1, L2): the list L2 is obtained from L1 by reversing the order of the elements.

-  ?- rev([], X).
-    X = [].
   ?- rev([1,2,3], X).
     X = [3,2,1].
+  ?- rev([], X).
+    X = [].
 
''' hint = {} diff --git a/prolog/problems/lists/rev_2/sl.py b/prolog/problems/lists/rev_2/sl.py new file mode 100644 index 0000000..95ba8b7 --- /dev/null +++ b/prolog/problems/lists/rev_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'rev/2' +slug = 'Obrni seznam' + +description = '''\ +

rev(L1, L2): seznam L2 ima elemente v obratnem vrstnem redu kot seznam L1.

+
+  ?- rev([1,2,3], X).
+    X = [3,2,1].
+  ?- rev([], X).
+    X = [].
+
''' + +hint = {} diff --git a/prolog/problems/lists/shiftleft_2/sl.py b/prolog/problems/lists/shiftleft_2/sl.py new file mode 100644 index 0000000..44e726f --- /dev/null +++ b/prolog/problems/lists/shiftleft_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'shiftleft/2' +slug = 'Premakni elemente seznama za eno mesto v levo' + +description = '''\ +

shiftleft(L1, L2): elemente v seznamu L1 za eno mesto premaknemo v levo ("circular shift").

+
+  ?- shiftleft([1,2,3,4,5], X).
+    X = [2,3,4,5,1].
+
''' + +hint = {} diff --git a/prolog/problems/lists/shiftright_2/sl.py b/prolog/problems/lists/shiftright_2/sl.py new file mode 100644 index 0000000..9d84510 --- /dev/null +++ b/prolog/problems/lists/shiftright_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'shiftright/2' +slug = 'Premakni elemente seznama za eno mesto v desno' + +description = '''\ +

shiftright(L1, L2): elemente v seznamu L1 za eno mesto premaknemo v desno ("circular shift").

+
+  ?- shiftright([1,2,3,4,5], X).
+    X = [5,1,2,3,4].
+
''' + +hint = {} diff --git a/prolog/problems/lists/sublist_2/sl.py b/prolog/problems/lists/sublist_2/sl.py new file mode 100644 index 0000000..27d9b54 --- /dev/null +++ b/prolog/problems/lists/sublist_2/sl.py @@ -0,0 +1,19 @@ +# coding=utf-8 + +name = 'sublist/2' +slug = 'Generiraj vse podsezname danega seznama' + +description = '''\ +

sublist(L, SL): SL je podseznam seznama L. Predikat naj vrne vse možne podsezname, enega po enega.

+
+  ?- sublist([1,2,3], X).
+    X = [] ;
+    X = [1] ;
+    X = [1,2] ;
+    X = [1,2,3] ;
+    X = [2] ;
+    X = [2,3] ;
+    X = [3].
+
''' + +hint = {} diff --git a/prolog/problems/lists/sum_2/sl.py b/prolog/problems/lists/sum_2/sl.py new file mode 100644 index 0000000..0e1e6d6 --- /dev/null +++ b/prolog/problems/lists/sum_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'sum/2' +slug = 'Izračunaj vsoto elementov v seznamu' + +description = '''\ +

sum(L, Sum): Sum je vsota vseh elementov v seznamu L.

+
+  ?- sum([1,2,3], Sum).
+    Sum = 6.
+
''' + +hint = {} diff --git a/prolog/problems/sets/diff_3/sl.py b/prolog/problems/sets/diff_3/sl.py new file mode 100644 index 0000000..d9b89e7 --- /dev/null +++ b/prolog/problems/sets/diff_3/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'diff/3' +slug = 'Poišči razliko dveh množic' + +description = '''\ +

diff(S1, S2, D): seznam D vsebuje elemente iz S1, ki niso v S2.

+
+  ?- diff([2,3,5,1,7,9], [3,7,4,5,6], D).
+    D = [2,1,9].
+
''' + +hint = {} diff --git a/prolog/problems/sets/intersect_3/sl.py b/prolog/problems/sets/intersect_3/sl.py new file mode 100644 index 0000000..a6af2d5 --- /dev/null +++ b/prolog/problems/sets/intersect_3/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'intersect/3' +slug = 'Poišči presek dveh množic' + +description = '''\ +

intersect(S1, S2, I): seznam I vsebuje presek elementov v S1 in S2.

+
+  ?- intersect([1,5,6,3,4,2], [8,1,5,9,4,3], I).
+    I = [1,5,3,4].
+
''' + +hint = {} diff --git a/prolog/problems/sets/is_subset_2/sl.py b/prolog/problems/sets/is_subset_2/sl.py new file mode 100644 index 0000000..ccec5b0 --- /dev/null +++ b/prolog/problems/sets/is_subset_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'is_subset/2' +slug = 'Preveri, če je prva množica podmnožica od druge' + +description = '''\ +

is_subset(S1, S2): množica S1 je podmnožica od S2.

+
+  ?- is_subset([2,1,3,5,0], [3,2,1,4,5,9]).
+    false.
+  ?- is_subset([2,1,3,5], [3,2,1,4,5,9]).
+    true.
+
''' + +hint = {} diff --git a/prolog/problems/sets/is_superset_2/sl.py b/prolog/problems/sets/is_superset_2/sl.py new file mode 100644 index 0000000..77d0d9d --- /dev/null +++ b/prolog/problems/sets/is_superset_2/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'is_superset/2' +slug = 'Preveri, če je prva množica nadmnožica od druge' + +description = '''\ +

is_superset(S1, S2): množica S1 je nadmnožica (vsebuje vse elemente) od S2.

+
+  ?- is_superset([3,2,1,4,5,9], [2,1,3,5]).
+    true.
+  ?- is_superset([3,2,1,4,5,9], [2,1,3,5,0]).
+    false.
+
''' + +hint = {} diff --git a/prolog/problems/sets/powerset_2/sl.py b/prolog/problems/sets/powerset_2/sl.py new file mode 100644 index 0000000..a782dee --- /dev/null +++ b/prolog/problems/sets/powerset_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'powerset/2' +slug = 'Poišči potenčno množico od dane množice' + +description = '''\ +

powerset(Set, Powerset): množica Powerset vsebuje vse podmnožice od množice Set.

+
+  ?- powerset([1,2,3], L).
+    L = [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]].
+
''' + +hint = {} diff --git a/prolog/problems/sets/subset_2/sl.py b/prolog/problems/sets/subset_2/sl.py new file mode 100644 index 0000000..eae4fcf --- /dev/null +++ b/prolog/problems/sets/subset_2/sl.py @@ -0,0 +1,20 @@ +# coding=utf-8 + +name = 'subset/2' +slug = 'Generiraj vse podmnožice dane množice' + +description = '''\ +

subset(Set, Subset): množica Subset je podmnožica od Set. Ta predikat naj, eno po eno, generira vse veljavne podmnožice.

+
+  ?- subset([1,2,3], SS).
+    SS = [1,2,3] ;
+    SS = [1,2] ;
+    SS = [1,3] ;
+    SS = [1] ;
+    SS = [2,3] ;
+    SS = [2] ;
+    SS = [3] ;
+    SS = [].
+
''' + +hint = {} diff --git a/prolog/problems/sets/union_3/sl.py b/prolog/problems/sets/union_3/sl.py new file mode 100644 index 0000000..27d3088 --- /dev/null +++ b/prolog/problems/sets/union_3/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'union/3' +slug = 'Poišči unijo dveh množic' + +description = '''\ +

union(S1, S2, U): seznam U predstavlja unijo elementov v seznamih S1 in S2, duplikatov (kot se za množice spodobi) ni.

+
+  ?- union([1,5,2,3], [3,4,8,2], U).
+    U = [1,5,3,4,8,2].
+
''' + +hint = {} diff --git a/prolog/problems/sorting/is_sorted_1/sl.py b/prolog/problems/sorting/is_sorted_1/sl.py new file mode 100644 index 0000000..5d4c1c5 --- /dev/null +++ b/prolog/problems/sorting/is_sorted_1/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'is_sorted/1' +slug = 'Preveri, če so elementi seznama naraščajoče urejeni' + +description = '''\ +

is_sorted(L): elementi v seznamu L morajo biti urejeni v naraščajočem vrstnem redu.

+
+  ?- is_sorted([2,3,6,8,12]).
+    true.
+  ?- is_sorted([2,3,1,6,5]).
+    false.
+
''' + +hint = {} diff --git a/prolog/problems/sorting/isort_2/sl.py b/prolog/problems/sorting/isort_2/sl.py new file mode 100644 index 0000000..79c3239 --- /dev/null +++ b/prolog/problems/sorting/isort_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'isort/2' +slug = 'Uredi seznam z uporabo urejanja z vstavljanjem' + +description = '''\ +

isort(L, SL): seznam SL vsebuje elemente iz seznama L urejene v naraščajočem vrstnem redu. Uporabi predikat sins/3 za implementacijo urejanja z vstavljanjem.

+
+  ?- isort([2,3,1,5,4], L).
+    L = [1,2,3,4,5].
+
''' + +hint = {} diff --git a/prolog/problems/sorting/pivoting_4/sl.py b/prolog/problems/sorting/pivoting_4/sl.py new file mode 100644 index 0000000..b18e112 --- /dev/null +++ b/prolog/problems/sorting/pivoting_4/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'pivoting/4' +slug = 'Razdeli seznam na dva dela glede na podani element (pivot)' + +description = '''\ +

pivoting(P, L, S, G): seznam S vsebuje elemente iz L manjše ali enake P, seznam G pa elemente iz L večje od P. Vrstni red elementov v S in G naj bo enak kot v L.

+
+  ?- pivoting(4, [1,4,5,8,6,4,2], S, G).
+    S = [1,4,4,2], G = [5,8,6].
+
''' + +hint = {} diff --git a/prolog/problems/sorting/quick_sort_2/sl.py b/prolog/problems/sorting/quick_sort_2/sl.py new file mode 100644 index 0000000..9611b46 --- /dev/null +++ b/prolog/problems/sorting/quick_sort_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'quick_sort/2' +slug = 'Uredi seznam z algoritmom quicksort' + +description = '''\ +

quick_sort(L, SL): seznam SL vsebuje elemente iz L urejene v naraščajočem vrstnem redu. Uporabi predikat pivoting/4 za implementacijo algoritma quicksort.

+
+  ?- quick_sort([2,3,1,5,4], L).
+    L = [1,2,3,4,5].
+
''' + +hint = {} diff --git a/prolog/problems/sorting/sins_3/sl.py b/prolog/problems/sorting/sins_3/sl.py new file mode 100644 index 0000000..22e51b2 --- /dev/null +++ b/prolog/problems/sorting/sins_3/sl.py @@ -0,0 +1,15 @@ +# coding=utf-8 + +name = 'sins/3' +slug = 'Vstavi element na ustrezno mesto v urejen seznam' + +description = '''\ +

sins(X, SortedList, NewList): seznam NewList dobiš tako, da vstaviš element X v SortedList na ustrezno mesto tako, da ohraniš urejenost elementov.

+
+  ?- sins(4, [1,2,3,5], L).
+    L = [1,2,3,4,5].
+  ?- sins(3, [1,2,3,4], L).
+    L = [1,2,3,3,4].
+
''' + +hint = {} diff --git a/prolog/problems/sorting/slowest_sort_ever_2/sl.py b/prolog/problems/sorting/slowest_sort_ever_2/sl.py new file mode 100644 index 0000000..c62582c --- /dev/null +++ b/prolog/problems/sorting/slowest_sort_ever_2/sl.py @@ -0,0 +1,13 @@ +# coding=utf-8 + +name = 'slowest_sort_ever/2' +slug = 'Uredi seznam elementov s pomočjo naključnih permutacij' + +description = '''\ +

slowest_sort_ever(L, SL): seznam SL vsebuje elemente seznama L v naraščajočem vrstnem redu. Časovna zahtevnost algoritma naj bo O(n * n!).

+
+  ?- slowest_sort_ever([2,3,1,5,4], L).
+    L = [1,2,3,4,5].
+
''' + +hint = {} -- cgit v1.2.1