summaryrefslogtreecommitdiff
path: root/prolog/problems/sorting/sins_3/en.py
blob: 2d9cf98a71a448d264139620ec0a220802b303dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# coding=utf-8

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 = {}