Write a (list-based) insertion sort algorithm in Prolog. Heres what it looks like in C, using arrays:

Question:

Write a (list-based) insertion sort algorithm in Prolog. Here’s what it looks  like in C, using arrays:

void insertion_sort(int A[], int N) int i, j, t; for (i = 1; i < N; i++) { %3D t = A[i]; for (j = i; j > 0; j--) { if (t >= A[j-1]) break; A[j] A[j-1]; A[j] = t; }

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: