Question: Write a Maple function which takes as input a list L = |l_1..., l_n] and a blocking factor b and returns a list of lists

Write a Maple function which takes as input a list L = |l_1..., l_n] and a blocking factor b and returns a list of lists [L_1.., L_t], where t= [n/b, ] the length of the list L_i is b except for possibly the last list L_t whose length n_t may be less than b. The elements in list L_1 are the first b elements of L, the elements of L_2 are the second b elements of L, and so on, with L_t containing the last n_t elements of L. For example, if L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and b = 3, the output should be M =[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]. Write a second function which inverts this blocking. For example, if the input to this function is the list M, then the output should be the list L.

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 Programming Questions!