Question: Use SWI Prolog to write the following programs . Make sure the output from your programs looks just like the sample output in the problems.
8. Write a function, bubblesort, that takes a list of numbers as input and returns the list sorted in ascending order using a bubblesort. 2- bubblesort ( [ 1, 3, 7, 11, 2, 5, 8, 6, 4] , X). x= [ 1, 2, 3, 4, 5, 6, 7, 8, 11]. Yes. To help you with this program, here should be a quicksort, done in Prolog quicksort ([xixs],Ys) partition (Xs, X, Littles, Bigs), quicksort (Littles, Ls),* quicksort (Bigs, Bs), append (Ls, [XIBs], Ys). quicksort(,) partition ((XIXs], Y, [XLs], Bs) :-X- Y, partition (Xs, Y, Ls, Bs). partition([, Y, ,[)
Step by Step Solution
There are 3 Steps involved in it
Question Write 2 5 0 words one double spaced page from your perspective as ... View full answer
Get step-by-step solutions from verified subject matter experts
