Question: Write each of the following pure functions (a function is pure if it does not update any of the arguments or global variables). The actual

 Write each of the following pure functions (a function is pure

Write each of the following pure functions (a function is pure if it does not update any of the arguments or global variables). The actual return type List should be the same as the actual type of the parameter List. No functions in the Collections class can be used. 1.1 The function take(n, lst) returns a list that takes n elements from 1st. public static List take(int n, List lst) 1.2 The function drop(n, lst) returns a list that keeps all the elements of lst except for the first n elements. For example, drop(5, (1,2,3,4,5,6,7,8,9,10)) returns (6,7,8,9,10). public static List drop(int n, List lst) 1.3 The function reverse (1st) returns a copy of the list ist with the elements reversed. public static List reverse (List lst) 1.4 The function sortedDown (1st) checks if Ist is sorted in non-increasing order. For exam- ple, for 1st - [3,3,2,1), it returns true. public static > boolean sortedDown (List 1st) 2. Write a program that reads words from a text file and displays all the words (duplicates allowed) in ascending alphabetical order. The text file is passed as a command-line argument

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!