The merge-sort algorithm for sorting a list is based on dividing the list into smaller lists, then
Fantastic news! We've Found the answer you've been seeking!
Question:
The merge-sort algorithm for sorting a list is based on dividing the list into smaller lists, then
sorting each smaller list and finally merging these sorted smaller lists into one resulting list.
Accordingly, to sort list L:
- Divide L into two lists L1 and L2 of approximately equal length
- Sort L1 and L2 (using merge-sort) giving S1 and S2 respectively
- Merge S1 and S2 giving the sorted list R.
Write a PROLOG implementation of merge-sort.
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date: