B.Tech. (I) - ICP-132 (2008) Assignment 4 Level 0 ------- 1. Given natural numbers x and y construct a list with numbers 1^2, 2^2,...,(x-1)^2,(x+1)^2,(x+2)^2,...y^2. Find the average value from the stored list using a function. 2. Copy list created as in problem 1 into a new list (a) using a function, and (b) without using a function. 3. Make a list of first 10 prime numbers. Level 1 ------- 1. Make a list of vectors that contains two vectors such that: a. first vector has first 10 positive odd numbers, and b. second vector has first 15 postive even numbers. Print all the numbers stored. 2. Make a vector of list such that: a. first list has first 10 positive odd numbers, and b. second list has first 15 postive even numbers. Print all the numbers stored. 3. Let L1 and L2 be two lists such that: L1 = 1 -> 2 -> 3 -> 4 -> 5 L2 = 15 -> 14 -> 13 -> 12 -> 11. Create a list L3 = L1 + L2 such that: L3 = 1 -> 2 -> 3 -> 4 -> 5 -> 15 -> 14 -> 13 -> 12 -> 11 Level 2 ------- 1. Insert x^2 into its correct place as mentioned in Level 0 prob 1 in a given list. 2. Let L1 and L2 be two lists such that: L1 = 1 -> 2 -> 3 -> 4 -> 5 L2 = 15 -> 16 -> 17 -> 18 -> 19. Create a list L3 = L1 + L2 such that: L3 = 16 -> 18 -> 20 -> 22 -> 24 3. A stack is a data structure which is opposite to queue. Which ever element comes last will be the first to move out. Using a list L of integers, implement functions given below a. void push(L, i), where i is the number to be enqueued b. int pop(L), returns the last element put in the stack c. int size(L), returns the number of elements in the stack L d. int top(L), returns the element that will be popped next in L Level 3 ------- 1. Use a list L to implement a queue as given in Asssignment 3. 2. Given a list with several elements, insert elements 1 to 10 at i'th element. 3. Given a list of integers, remove all the duplicates using a function uniq(L).