Skip to content
Dr Jack HW Helper
Home
Browse
About
Contact
Academic Integrity
T
Academic Integrity:
tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.
Home
Browse
W
Write a gofer function merge that takes two increasing list of integers and merg
Write a gofer function merge that takes two increasing list of integers and merg
ID:
3611463
• Letter:
W
Question
Write a gofer function merge that takes two increasing list of integers and merge them into single increasing list(without any duplicate values)
Explanation / Answer
listReverse :: [Int] -> [Int] -> [Int] listReverse [] temp = temp listReverse (head : tail) temp = listReverse tail (head: temp) mergeHelp :: [Int] -> [Int] -> [Int]->[Int] mergeHelp [] [] temp = temp mergeHelp (head : tail) [] temp = mergeHelp tail [](head : temp) mergeHelp [] (head : tail) temp = mergeHelp []tail (head : temp) mergeHelp (p : q) (a : b) temp | p
a = mergeHelp( p :q) b (a : temp) mergeHelp (p : q) (a : b) temp = mergeHelp q b (p : temp) merger :: [Int] -> [Int] -> [Int] merger l m = listReverse (mergeHelp l m []) []
Related Questions
Write a general program for growing a binary tree and use it to train a tree ful
Question #3780521
Write a general program for growing a binary tree and use it to train a tree ful
Question #3800791
Write a generator expression that repeats each character in a given string 4 tim
Question #3751335
Write a generic Insertion sort method that restricts the generic type to classes
Question #3732469
Write a generic class Pair which has 2 type parameters, F and S, representing th
Question #3823327
Write a generic class Pair which has two type parameters F and S, each represent
Question #3786669
Write a generic class Pair which has two type parameters—F and S—each representi
Question #3591794
Write a generic class Pair which has two type parameters—F and S—each representi
Question #3838993
Navigate
Browse (All)
Browse W
Subjects
Previous
Write a gofer function map2 that takes a list of functions andlist of values ret
Next
Write a good explanation and 2 or more differences that you can see in attachmen