View the step-by-step solution to:

Question

Need help with converting this F# code into Java Please.


open System

let rec remove aList

atm =

   if List.isEmpty aList then []

   elif List.head aList = atm then (List.tail aList)

   else (List.head aList) :: remove (List.tail aList) atm

   

let rec smallest aList atm =

  if List.isEmpty aList then atm

   elif( List.head aList) < atm then (smallest (List.tail aList) (List.head aList))

   else smallest (List.tail aList) atm

   

let rec selection aList =

   if List.isEmpty aList then []

   else (smallest aList (List.head aList)) ::

   selection (remove aList (smallest aList (List.head aList)))


let test_list1 = [1;2;3;4;-4;-5;7;8]

printfn "%A" (selection test_list1)

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Computer Science tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors