s do fast within 10 minutes it's urgent and i will give like for sure Solution must be in typed form /* QUESTION 2: Min/Max and Evens/Odds */ /* Implement min and max functions using fold_left An empty list has no minimum or maximum value, therefore, return undefined. */ const ls_min = ls => /** **/ undefined; /** **/ const ls_max = ls => /** **/ undefined; /** **/ assert(ls_min(ls) == 1); assert(ls_max(ls) == 5); /* Implement two functions that return evens and odds from a list of integers using filter */ const ls_evens = ls => /** **/ undefined; /** **/ const ls_odds = ls => /** **/ undefined; /** **/ assert(ls_evens(ls).equals(List([2,4]))); assert(ls_odds(ls).equals(List([1,3,5]))); /* Using function composition, implement a function that returns the maximum number in the even subset of a given list and another function that returns the minimum number in the evens. Recall the definition of compose below: */ function compose(f, g) { return (x) => { return f(g(x)); }; } const max_even = ls => /** **/ undefined; /** **/ const min_even = ls => /** **/ undefined; /** **/ assert(max_even(ls) == 4); assert(min_even(ls) ==

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 18PE
icon
Related questions
Question
Pls do fast within 10 minutes it's urgent and i will give like for sure Solution must be in typed form /* QUESTION 2: Min/Max and Evens/Odds */ /* Implement min and max functions using fold_left An empty list has no minimum or maximum value, therefore, return undefined. */ const ls_min = ls => /** **/ undefined; /** **/ const ls_max = ls => /** **/ undefined; /** **/ assert(ls_min(ls) == 1); assert(ls_max(ls) == 5); /* Implement two functions that return evens and odds from a list of integers using filter */ const ls_evens = ls => /** **/ undefined; /** **/ const ls_odds = ls => /** **/ undefined; /** **/ assert(ls_evens(ls).equals(List([2,4]))); assert(ls_odds(ls).equals(List([1,3,5]))); /* Using function composition, implement a function that returns the maximum number in the even subset of a given list and another function that returns the minimum number in the evens. Recall the definition of compose below: */ function compose(f, g) { return (x) => { return f(g(x)); }; } const max_even = ls => /** **/ undefined; /** **/ const min_even = ls => /** **/ undefined; /** **/ assert(max_even(ls) == 4); assert(min_even(ls) == 2)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Linked List Representation
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning