Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help in writing these in OCaml functional programming language asap !!! takes three input lists of integers, each of which is assumed to be

image text in transcribed

image text in transcribed

Please help in writing these in OCaml functional programming language asap!!!

takes three input lists of integers, each of which is assumed to be sorted. Their lengths are unimportant. It merges all three into a single sorted list of integers. The time complexity should be linear in the sum of the lengths of the three lists. Write a function called which will take one argument (a list of integers) and return the index of the smallest element (not the value!). The index is for the first element, for the second element, and so on. Note that we don't normally talk of "indices" for lists (as opposed to arrays, where we do), but we will do so here. If there is more than one copy of the smallest element, return the index of the first occurrence of the element in the list. Don't use higher-order list processing functions in this problem; just write a regular recursive list processing function. It can implement a recursive or iterative process as you see fit. Most especially, you are not allowed to call any sorting functions in this function (such as the function in the OCaml standard libraries). If the input list is empty, raise an exception with a meaningful error message. The easiest way to do this is to call the function with the error message; it will raise the exception for you

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago