Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Scheme program for each of the following. You can use the linprog server for your implementation - it has Scheme installed in
Write a Scheme program for each of the following. You can use the "linprog" server for your implementation - it has Scheme installed in it. a) To reverse a list. You are not allowed to use the built-in function "reverse". Input to the program is a list. Print the final list. For instance, Ist = (5 11 22 3) output: (3 22 11 5) (5 points) b) To insert an element "a" in a sorted list "Ist" (sorted in ascending order), such that the resulting list is still sorted. Input to the program are "a" and "Ist". Print the final list. For instance, 1st (14 7 12 19) and a = 6, output: (1467 12 19) (5 points) c) To check if an item "a" is present in a list "Ist". The program should return "#t" if the item is present and "#f" otherwise. Input to the program are "a" and "Ist". For instance, 1st (6 22 3 7 8) and a = 3 output: #t 1st (6 22 3 7 8) and a = 9 output: #f (5 points) d) Which takes in two lists "Ist 1" and "Ist2", both of which are individually sorted (in ascending order), and returns a list containing the elements of both Ist1 and 1st2 in sorted order. Print the final list. Input to the program are "Ist 1" and "Ist2". For instance, 1st 1 (1357) and 1st2 = (2468) output: (12345678) (5 points)
Step by Step Solution
★★★★★
3.53 Rating (146 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started