Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN ML : Write a quick sort function of type int list -> int list. Here is a review for quick sort algorithm. First pick

IN ML : Write a quick sort function of type int list -> int list. Here is a review for quick sort algorithm. First pick an element and call it pivot. (The head of the list is an easy choice for the pivot.) Partition the rest of the list into two sublists, one with all the elements less than the pivot and another one with all the elements not less than the pivot. Recursively sort the sublists. Combine two sublists and pivot into final sorted list.

image text in transcribed

val partition = fn : int * int list-> int list * int list val quicksort = fn : int list-> int list val nevQuickSort = fn : int list-> int list val it - unit -val x=[3, 1, 4, 8, 9, 5, 7, 6, 2,0]; val x = [3,1,4,8,9,5,7,6,2,0] : int list - quickSort x; val it = [0,1,2,3,4,5,6,7,8,9] : int list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

=+14.4. 1 Let C be the set of continuity points of F.

Answered: 1 week ago