summaryrefslogtreecommitdiff
path: root/prolog/problems/sorting/sins_3/en.py
blob: 0bf74830df0cb00787c1a5ca38836196a1e87ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
name = 'sins/3'
slug = 'insert an element at correct position into a sorted list'

description = '''\
<p><code>sins(X, SortedList, NewList)</code>: the list <code>NewList</code> is obtained by inserting <code>X</code> into <code>SortedList</code> at the correct position to preserve the non-decreasing order of elements.</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 = {}