diff options
author | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2015-12-14 13:57:29 +0100 |
---|---|---|
committer | Aleksander Sadikov <aleksander.sadikov@fri.uni-lj.si> | 2015-12-14 15:25:36 +0100 |
commit | 384d3c501a38b489312496b0bf9522bdf29053d8 (patch) | |
tree | bd1a81ce29449ee7f8d017b86365fda710afaf96 | |
parent | 4918cebf5f135993cd1d2d61bc906559e627f526 (diff) |
Add Slovenian translations for Prolog exercises
37 files changed, 543 insertions, 2 deletions
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 = '''\ +<p><code>checkLicensePlate(LP, E1, E2)</code>: iz cifer v seznamu <code>LP</code> se da sestaviti veljavno enačbo <code>E1</code> = <code>E2</code>. <code>E1</code> in <code>E2</code> sta aritmetična izraza, sestavljena iz podseznamov <code>Plate</code> z uporabo aritmetičnih operatorjev (<code>+</code>, <code>-</code>, <code>*</code> and <code>/</code>). Dodaten unarni minus se lahko vstavi na začetek izrazov <code>E1</code> in <code>E2</code>.</p> +<pre> + ?- 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. +</pre>''' + +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 = '''\ +<p><code>firstMinus(L1, L2)</code>: seznam <code>L2</code> je enak kot <code>L1</code>, razen prvega elementa, ki je lahko negiran ali pa ne. Predikat naj vrne obe rešitvi, eno za drugo.</p> +<pre> + ?- firstMinus([1,2,3], L). + L = [1,2,3] ; + L = [-1,2,3]. +</pre>''' + +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 = '''\ +<p><code>genexp(L, E)</code>: Izraz <code>E</code> je zgrajen iz številk v seznamu <code>L</code> z dodajanjem aritmetičnih operatorjev. Predikat naj vrača vse možne izraze, enega po enega.</p> +<pre> + ?- 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 ; + ... +</pre>''' + +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 = '''\ +<p><code>getdigits(L, DL)</code>: seznam <code>DL</code> vsebuje vse številke iz seznama <code>L</code>, vrstni red elementov se ohrani.</p> +<pre> + ?- getdigits([2,3,e,-,4,b], DL). + DL = [2,3,4]. +</pre>''' + +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 = '''\ +<p><code>joindigits(L, NL)</code>: seznam <code>NL</code> dobimo iz seznama <code>L</code> tako, da poljubno združujemo sosednja števila. Predikat naj vrača vse možnosti, eno po eno.</p> +<pre> + ?- joindigits([3,2,4], NL). + NL = [324] ; + NL = [32,4] ; + NL = [3,24] ; + NL = [3,2,4]. +</pre>''' + +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 = '''\ +<p><code>conc(L1, L2, L)</code>: seznam <code>L</code> dobiš tako, da seznamu <code>L1</code> na konec dodaš elemente seznama <code>L2</code>.</p> +<pre> + ?- conc([1,2], [3,4], X). + X = [1,2,3,4]. + ?- conc(X, [], [1,2,3]). + X = [1,2,3]. +</pre>''' + +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 = '''\ +<p><code>count(X, L, N)</code>: <code>N</code> je število kolikokrat se element <code>X</code> pojavi v seznamu <code>L</code>.</p> +<pre> + ?- count(1, [1,2,1,3,1], N). + N = 3. +</pre>''' + +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 = '''\ +<p><code>del(X, L1, L2)</code>: seznam <code>L2</code> dobimo iz seznama <code>L1</code> tako da zbrišemo element <code>X</code>.</p> +<pre> + ?- 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]. +</pre>''' + +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 = '''\ +<p><code>divide(L, L1, L2)</code>: seznam <code>L1</code> vsebuje elemente na lihih pozicijah v seznamu <code>L</code>, seznam <code>L2</code> pa elemente na sodih pozicijah v <code>L</code>.</p> +<pre> + ?- 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]. +</pre>''' + +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 = '''\ +<p><code>dup(L1, L2)</code>: seznam <code>L2</code> dobimo iz <code>L1</code> tako, da podvojimo vsak element.</p> +<pre> + ?- dup([1,2], X). + X = [1,1,2,2]. + ?- dup([1,2,3], X). + X = [1,1,2,2,3,3]. +</pre>''' + +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 = '''\ +<p><code>evenlen(L)</code>: seznam <code>L</code> ima sodo število elementov.<br /> +<code>oddlen(L)</code>: seznam <code>L</code> ima liho število elementov.</p> +<pre> + ?- oddlen([1,2,3,4,5]). + true. + ?- oddlen([1,2,3,4]). + false. + ?- evenlen([1,2,3,4]). + true. +</pre>''' + +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 = '''\ +<p><code>insert(X, L1, L2)</code>: seznam <code>L2</code> dobimo iz <code>L1</code> tako, da vstavimo element <code>X</code> na poljubno mesto. Predikat naj vrne vse možne rešitve, eno za drugo.</p> +<pre> + ?- insert(1, [2,3], L). + L = [1,2,3] ; + L = [2,1,3] ; + L = [2,3,1]. +</pre>''' + +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 = '''\ +<p><code>len(L, Len)</code>: <code>Len</code> je dolžina seznama <code>L</code>.</p> +<pre> + ?- len([1,2,3], Len). + Len = 3. +</pre>''' + +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 = '''\ +<p><code>max(L, Max)</code>: <code>Max</code> je največji element v seznamu <code>L</code>.</p> +<pre> + ?- max([5,4,1,6], M). + M = 6. + ?- max([3,2,2], M). + M = 3. +</pre>''' + +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 = '''\ +<p><code>memb(E, L)</code>: <code>E</code> je element seznama <code>L</code>.</p> +<pre> + ?- memb(X, [1,2,3]). + X = 1 ; + X = 2 ; + X = 3. + ?- memb(1, [3,2,X]). + X = 1. +</pre>''' + +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 = '''\ +<p><code>min(L, Min)</code>: <code>Min</code> je najmanjši element v seznamu <code>L</code>.</p> +<pre> + ?- min([5,4,1,6], M). + M = 1. + ?- min([3,2,2], M). + M = 2. +</pre>''' + +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 = '''\ +<p><code>palindrome(L)</code>: Elementi seznama <code>L</code> se preberejo v istem vrstnem redu z začetka in s konca seznama.</p> +<pre> + ?- palindrome([1,2,3,2,1]). + true. + ?- palindrome([1,2,3]). + false. +</pre>''' + +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 = '''\ +<p><code>permute(L1, L2)</code>: seznam <code>L2</code> je permutacija vrstnega reda elementov v seznamu <code>L1</code>.</p> +<pre> + ?- 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]. +</pre>''' + +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 = '''\ <p><code>rev(L1, L2)</code>: the list <code>L2</code> is obtained from <code>L1</code> by reversing the order of the elements.</p> <pre> - ?- rev([], X). - X = []. ?- rev([1,2,3], X). X = [3,2,1]. + ?- rev([], X). + X = []. </pre>''' 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 = '''\ +<p><code>rev(L1, L2)</code>: seznam <code>L2</code> ima elemente v obratnem vrstnem redu kot seznam <code>L1</code>.</p> +<pre> + ?- rev([1,2,3], X). + X = [3,2,1]. + ?- rev([], X). + X = []. +</pre>''' + +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 = '''\ +<p><code>shiftleft(L1, L2)</code>: elemente v seznamu <code>L1</code> za eno mesto premaknemo v levo ("circular shift").</p> +<pre> + ?- shiftleft([1,2,3,4,5], X). + X = [2,3,4,5,1]. +</pre>''' + +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 = '''\ +<p><code>shiftright(L1, L2)</code>: elemente v seznamu <code>L1</code> za eno mesto premaknemo v desno ("circular shift").</p> +<pre> + ?- shiftright([1,2,3,4,5], X). + X = [5,1,2,3,4]. +</pre>''' + +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 = '''\ +<p><code>sublist(L, SL)</code>: <code>SL</code> je podseznam seznama <code>L</code>. Predikat naj vrne vse možne podsezname, enega po enega.</p> +<pre> + ?- sublist([1,2,3], X). + X = [] ; + X = [1] ; + X = [1,2] ; + X = [1,2,3] ; + X = [2] ; + X = [2,3] ; + X = [3]. +</pre>''' + +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 = '''\ +<p><code>sum(L, Sum)</code>: <code>Sum</code> je vsota vseh elementov v seznamu <code>L</code>.</p> +<pre> + ?- sum([1,2,3], Sum). + Sum = 6. +</pre>''' + +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 = '''\ +<p><code>diff(S1, S2, D)</code>: seznam <code>D</code> vsebuje elemente iz <code>S1</code>, ki niso v <code>S2</code>.</p> +<pre> + ?- diff([2,3,5,1,7,9], [3,7,4,5,6], D). + D = [2,1,9]. +</pre>''' + +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 = '''\ +<p><code>intersect(S1, S2, I)</code>: seznam <code>I</code> vsebuje presek elementov v <code>S1</code> in <code>S2</code>.</p> +<pre> + ?- intersect([1,5,6,3,4,2], [8,1,5,9,4,3], I). + I = [1,5,3,4]. +</pre>''' + +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 = '''\ +<p><code>is_subset(S1, S2)</code>: množica <code>S1</code> je podmnožica od <code>S2</code>.</p> +<pre> + ?- 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. +</pre>''' + +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 = '''\ +<p><code>is_superset(S1, S2)</code>: množica <code>S1</code> je nadmnožica (vsebuje vse elemente) od <code>S2</code>.</p> +<pre> + ?- 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. +</pre>''' + +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 = '''\ +<p><code>powerset(Set, Powerset)</code>: množica <code>Powerset</code> vsebuje vse podmnožice od množice <code>Set</code>.</p> +<pre> + ?- powerset([1,2,3], L). + L = [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]]. +</pre>''' + +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 = '''\ +<p><code>subset(Set, Subset)</code>: množica <code>Subset</code> je podmnožica od <code>Set</code>. Ta predikat naj, eno po eno, generira vse veljavne podmnožice.</p> +<pre> + ?- 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 = []. +</pre>''' + +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 = '''\ +<p><code>union(S1, S2, U)</code>: seznam <code>U</code> predstavlja unijo elementov v seznamih <code>S1</code> in <code>S2</code>, duplikatov (kot se za množice spodobi) ni.</p> +<pre> + ?- union([1,5,2,3], [3,4,8,2], U). + U = [1,5,3,4,8,2]. +</pre>''' + +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 = '''\ +<p><code>is_sorted(L)</code>: elementi v seznamu <code>L</code> morajo biti urejeni v naraščajočem vrstnem redu.</p> +<pre> + ?- is_sorted([2,3,6,8,12]). + true. + ?- is_sorted([2,3,1,6,5]). + false. +</pre>''' + +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 = '''\ +<p><code>isort(L, SL)</code>: seznam <code>SL</code> vsebuje elemente iz seznama <code>L</code> urejene v naraščajočem vrstnem redu. Uporabi predikat <code>sins/3</code> za implementacijo urejanja z vstavljanjem.</p> +<pre> + ?- isort([2,3,1,5,4], L). + L = [1,2,3,4,5]. +</pre>''' + +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 = '''\ +<p><code>pivoting(P, L, S, G)</code>: seznam <code>S</code> vsebuje elemente iz <code>L</code> <em>manjše ali enake</em> <code>P</code>, seznam <code>G</code> pa elemente iz <code>L</code> <em>večje od</em> <code>P</code>. Vrstni red elementov v <code>S</code> in <code>G</code> naj bo enak kot v <code>L</code>.</p> +<pre> + ?- pivoting(4, [1,4,5,8,6,4,2], S, G). + S = [1,4,4,2], G = [5,8,6]. +</pre>''' + +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 = '''\ +<p><code>quick_sort(L, SL)</code>: seznam <code>SL</code> vsebuje elemente iz <code>L</code> urejene v naraščajočem vrstnem redu. Uporabi predikat <code>pivoting/4</code> za implementacijo algoritma quicksort.</p> +<pre> + ?- quick_sort([2,3,1,5,4], L). + L = [1,2,3,4,5]. +</pre>''' + +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 = '''\ +<p><code>sins(X, SortedList, NewList)</code>: seznam <code>NewList</code> dobiš tako, da vstaviš element <code>X</code> v <code>SortedList</code> na ustrezno mesto tako, da ohraniš urejenost elementov.</p> +<pre> + ?- 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]. +</pre>''' + +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 = '''\ +<p><code>slowest_sort_ever(L, SL)</code>: seznam <code>SL</code> vsebuje elemente seznama <code>L</code> v naraščajočem vrstnem redu. Časovna zahtevnost algoritma naj bo O(n * n!).</p> +<pre> + ?- slowest_sort_ever([2,3,1,5,4], L). + L = [1,2,3,4,5]. +</pre>''' + +hint = {} |