Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code in OCaml. Implementation needed. 4. In this question we want you to use find_max and remove to implement a selection sort algorithm. You

Please code in OCaml. Implementation needed.

image text in transcribedimage text in transcribed

4. In this question we want you to use find_max and remove to implement a selection sort algorithm. You can assume that the list contains no duplicates. # let rec selsort l = .. val selsort : 'a list -> 'a list = # selsort [1; 4; 2; 5; 3; 9; 6; 8; 7];; - : int list = [9; 8; 7; 6; 5; 4; 3; 2; 1] You are not allowed to use built-in sorting functions. Even though your code is polymorphic and should work on all types for which an order is defined (int, char, string) the grader will get confused if you try to give it a list containing items of different types. Please only test this on integer lists. (* Q4 TODO: Write your own tests for the selsort function. *) let selsort_tests = [ (* Your test cases go here. *) (* 04 TODO: Implement selsort. *) let rec selsort 1 = raise NotImplemented 4. In this question we want you to use find_max and remove to implement a selection sort algorithm. You can assume that the list contains no duplicates. # let rec selsort l = .. val selsort : 'a list -> 'a list = # selsort [1; 4; 2; 5; 3; 9; 6; 8; 7];; - : int list = [9; 8; 7; 6; 5; 4; 3; 2; 1] You are not allowed to use built-in sorting functions. Even though your code is polymorphic and should work on all types for which an order is defined (int, char, string) the grader will get confused if you try to give it a list containing items of different types. Please only test this on integer lists. (* Q4 TODO: Write your own tests for the selsort function. *) let selsort_tests = [ (* Your test cases go here. *) (* 04 TODO: Implement selsort. *) let rec selsort 1 = raise NotImplemented

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

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

ISBN: 3642341780, 978-3642341786

More Books

Students also viewed these Databases questions

Question

What is polarization? Describe it with examples.

Answered: 1 week ago

Question

e. What are notable achievements of the group?

Answered: 1 week ago