SlideShare a Scribd company logo
1 of 1
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.

More Related Content

Similar to Please help in writing these in OCaml functional programming language.docx

Notes3
Notes3Notes3
Notes3
hccit
 
CS 107 – Introduction to Computing and Programming – Spring 20.docx
CS 107 – Introduction to Computing and Programming – Spring 20.docxCS 107 – Introduction to Computing and Programming – Spring 20.docx
CS 107 – Introduction to Computing and Programming – Spring 20.docx
faithxdunce63732
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
irshad17
 
Functional programming
Functional programmingFunctional programming
Functional programming
Bas Bossink
 
in python Purpose The purpose of this assignment is to give you practi.docx
in python Purpose The purpose of this assignment is to give you practi.docxin python Purpose The purpose of this assignment is to give you practi.docx
in python Purpose The purpose of this assignment is to give you practi.docx
MichaelQEBMartinc
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
clearvisioneyecareno
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
Bryan O'Sullivan
 

Similar to Please help in writing these in OCaml functional programming language.docx (20)

searching
searchingsearching
searching
 
Csallner algorithms1
Csallner algorithms1Csallner algorithms1
Csallner algorithms1
 
Provide the implementations and signatures for the following operati.pdf
Provide the implementations and signatures for the following operati.pdfProvide the implementations and signatures for the following operati.pdf
Provide the implementations and signatures for the following operati.pdf
 
FINAL revised LIST in Python.pdf
FINAL revised LIST in Python.pdfFINAL revised LIST in Python.pdf
FINAL revised LIST in Python.pdf
 
Python for loop
Python for loopPython for loop
Python for loop
 
Notes3
Notes3Notes3
Notes3
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Chapter 4 algorithmic efficiency handouts (with notes)
Chapter 4   algorithmic efficiency handouts (with notes)Chapter 4   algorithmic efficiency handouts (with notes)
Chapter 4 algorithmic efficiency handouts (with notes)
 
CS 107 – Introduction to Computing and Programming – Spring 20.docx
CS 107 – Introduction to Computing and Programming – Spring 20.docxCS 107 – Introduction to Computing and Programming – Spring 20.docx
CS 107 – Introduction to Computing and Programming – Spring 20.docx
 
Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4Anton Kasyanov, Introduction to Python, Lecture4
Anton Kasyanov, Introduction to Python, Lecture4
 
Erlang kickstart
Erlang kickstartErlang kickstart
Erlang kickstart
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
MODULE-2.pptx
MODULE-2.pptxMODULE-2.pptx
MODULE-2.pptx
 
easyPy-Basic.pdf
easyPy-Basic.pdfeasyPy-Basic.pdf
easyPy-Basic.pdf
 
in python Purpose The purpose of this assignment is to give you practi.docx
in python Purpose The purpose of this assignment is to give you practi.docxin python Purpose The purpose of this assignment is to give you practi.docx
in python Purpose The purpose of this assignment is to give you practi.docx
 
tupple.pptx
tupple.pptxtupple.pptx
tupple.pptx
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
 
Real World Haskell: Lecture 3
Real World Haskell: Lecture 3Real World Haskell: Lecture 3
Real World Haskell: Lecture 3
 

More from kathrynj2

Please Show Work! 1- Mendel did experiments where he kept track of the.docx
Please Show Work! 1- Mendel did experiments where he kept track of the.docxPlease Show Work! 1- Mendel did experiments where he kept track of the.docx
Please Show Work! 1- Mendel did experiments where he kept track of the.docx
kathrynj2
 
Please help using data in second photo- Thank you Identify the main d.docx
Please help using data in second photo- Thank you  Identify the main d.docxPlease help using data in second photo- Thank you  Identify the main d.docx
Please help using data in second photo- Thank you Identify the main d.docx
kathrynj2
 

More from kathrynj2 (18)

Please solve h- where it asks to record the payment of interest on bon.docx
Please solve h- where it asks to record the payment of interest on bon.docxPlease solve h- where it asks to record the payment of interest on bon.docx
Please solve h- where it asks to record the payment of interest on bon.docx
 
Please Show Work! 1- Mendel did experiments where he kept track of the.docx
Please Show Work! 1- Mendel did experiments where he kept track of the.docxPlease Show Work! 1- Mendel did experiments where he kept track of the.docx
Please Show Work! 1- Mendel did experiments where he kept track of the.docx
 
Please help- Thank you in advance- You have just completed a simulatio.docx
Please help- Thank you in advance- You have just completed a simulatio.docxPlease help- Thank you in advance- You have just completed a simulatio.docx
Please help- Thank you in advance- You have just completed a simulatio.docx
 
Please help write a Python script that will take any text dataset and.docx
Please help write a Python script that will take any text dataset and.docxPlease help write a Python script that will take any text dataset and.docx
Please help write a Python script that will take any text dataset and.docx
 
Please help with the following questions- What is the total debt ratio.docx
Please help with the following questions- What is the total debt ratio.docxPlease help with the following questions- What is the total debt ratio.docx
Please help with the following questions- What is the total debt ratio.docx
 
Please Help Need ASAP JAVA Write a class named Food with the followin.docx
Please Help Need ASAP JAVA  Write a class named Food with the followin.docxPlease Help Need ASAP JAVA  Write a class named Food with the followin.docx
Please Help Need ASAP JAVA Write a class named Food with the followin.docx
 
Please help using data in second photo- Thank you Identify the main d.docx
Please help using data in second photo- Thank you  Identify the main d.docxPlease help using data in second photo- Thank you  Identify the main d.docx
Please help using data in second photo- Thank you Identify the main d.docx
 
please help me to do this - how I can do this- Homework- Install two V.docx
please help me to do this - how I can do this- Homework- Install two V.docxplease help me to do this - how I can do this- Homework- Install two V.docx
please help me to do this - how I can do this- Homework- Install two V.docx
 
please help me to asnwer all the question- It Biologh 212 thank you!.docx
please help me to asnwer all the question- It Biologh 212  thank you!.docxplease help me to asnwer all the question- It Biologh 212  thank you!.docx
please help me to asnwer all the question- It Biologh 212 thank you!.docx
 
Please help me draw this chart The City of Lethbridge has decided to b.docx
Please help me draw this chart The City of Lethbridge has decided to b.docxPlease help me draw this chart The City of Lethbridge has decided to b.docx
Please help me draw this chart The City of Lethbridge has decided to b.docx
 
please show all work Assume we are using the simple model for floating.docx
please show all work Assume we are using the simple model for floating.docxplease show all work Assume we are using the simple model for floating.docx
please show all work Assume we are using the simple model for floating.docx
 
please help esp on the first one 3- Bacteriophages have lytic and lys.docx
please help esp on the first one  3- Bacteriophages have lytic and lys.docxplease help esp on the first one  3- Bacteriophages have lytic and lys.docx
please help esp on the first one 3- Bacteriophages have lytic and lys.docx
 
Please review the Trade agreement between the North American Countries.docx
Please review the Trade agreement between the North American Countries.docxPlease review the Trade agreement between the North American Countries.docx
Please review the Trade agreement between the North American Countries.docx
 
Please provide 1 explanation and 1 example for each of the points abov.docx
Please provide 1 explanation and 1 example for each of the points abov.docxPlease provide 1 explanation and 1 example for each of the points abov.docx
Please provide 1 explanation and 1 example for each of the points abov.docx
 
PLEASE PROVIDE ME WITH DETAILED INFORMATION ON A RESEARCH INTERESTS F.docx
PLEASE PROVIDE ME WITH DETAILED INFORMATION ON A  RESEARCH INTERESTS F.docxPLEASE PROVIDE ME WITH DETAILED INFORMATION ON A  RESEARCH INTERESTS F.docx
PLEASE PROVIDE ME WITH DETAILED INFORMATION ON A RESEARCH INTERESTS F.docx
 
Please place the following events in transcription in the correct orde.docx
Please place the following events in transcription in the correct orde.docxPlease place the following events in transcription in the correct orde.docx
Please place the following events in transcription in the correct orde.docx
 
please match the processes below with the correct description Match th.docx
please match the processes below with the correct description Match th.docxplease match the processes below with the correct description Match th.docx
please match the processes below with the correct description Match th.docx
 
Please look up the Terri Schiavo case I- Introduction- Describe the p.docx
Please look up the Terri Schiavo case  I- Introduction- Describe the p.docxPlease look up the Terri Schiavo case  I- Introduction- Describe the p.docx
Please look up the Terri Schiavo case I- Introduction- Describe the p.docx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

Please help in writing these in OCaml functional programming language.docx

  • 1. 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.