programmer720
Programmer
I'm trying to come up with a selection sort algorithm for prolog. That is, lists X and Sorted satisfy the relation selection(X, Sorted) if Sorted is the sorted list containing all the elements of X.
For example, selection([3, 2, 2, 1, 4], Sorted) should return Sorted = [1, 2, 2, 3, 4].
Can someone please help? Thanks!
For example, selection([3, 2, 2, 1, 4], Sorted) should return Sorted = [1, 2, 2, 3, 4].
Can someone please help? Thanks!