Sanjay Goel, JIIT, 2006 Data Structure: Programming Assignments CSE/IT 3rd sem12. 09.06 1. WAP to simulate a robot ‘SimRob’ linear movement along X axis bounded by Left and Right wall. The robot has two sensors on two sided that get activated on hitting the wall on its side. On sensor activation the controller changes the direction of robot’s movement. Graphics is not compulsory. 2. Design DS for storing and using Truth table(5 input and three output variables)14.09.06 1. WAP a dual robot movement simulator “Robpair” using two ‘SimRobs’ (of possibly varying width) with already defined behavior. Graphics is not compulsory. 2. (Single student: 3 marks) WAP a multi robot movement simulator “Robmat” using multiple “Robpairs” at different Y positions. Graphics is not compulsory. 3. (Group of four: 3 marks each) WAP a circuit’s truth table generator using up to 10 circuit components with user defined truth tables. Each component can have up to 5 inputs and 3 outputs. The components are used to create a user defined combinational circuit. Your program should generate the truth table for the circuit from the available data. Graphics is not compulsory.19.09.06 1. (Single student: 2 marks) Design a data storage scheme for storing single variable polynomial functions and series of numbers. Design an algorithm to test if the given series is a Taylor series approximation (at x) for a given polynomial function and x0. Taylor series approx. of a given function is as follows:21.09.06 1. (Group of two: 2 marks each) Design a dynamic data structure for storing a randomly ordered collection of single variable polynomial functions and another static data structure for storing randomly-ordered collection of real number- sequences. The records in both the collections also should have additional provision for storing indices of all the matching entries (if any) in another collection. One entry in any collection may match with none, one or many entries in another. A number-sequence is declared as matching with a polynomial, if all the numbers in the sequence match with corresponding terms of the Taylor series expansion of a function for given x and x0 within the limits of a user-defined ‘permitted-mismatch’. Design an algorithm for updating matching indices in both the collections for a given user-defined input of ‘permitted-mismatch’, x and x0.
Sanjay Goel, JIIT, 2006 You have the freedom to change the matching context of the problem to different and interesting situations. For example, you could match the following: 2. Polygons with number sequences that represent area, perimeter, and side length. 3. Lines (equation form) with endpoint coordinates. 4. Sentences with number sequences that represent frequency count of alphabets. 5. Differential equations with solutions. Take prior permission of your lab instructor to work on the context of your choice. You should take this permission within this week before 23/09/06. If your chosen context is much more complex than the stated context, the marks allocated to this problem will increase by 50%.23.09.06 (Group of two) You have already created the UI for following applications. Now create Data Characterization Catalogue and Concept Map for these applications: 1. (1.5 marks each) A design team has conceived the following initial specifications of a search engine for a large company’s internal Digital Library: Only specially authorized users can upload new documents or new versions of old document. All employees can look at the documents. Information systems department will create, update and maintain a list of keywords for faster search facility. The search engine users can also search by entering any word through the keyboard. Searched documents are to be listed as follows: Case A: Faster search on a listed keyword: As per the frequency of occurrence of the word i.e. the documents having higher “density” of the chosen keyword will be listed before the documents having lower density, where density[k, d] = (Occurrence count of the word k in d)/(word count in d) Case B: Search by entering a word though the keyboard: As per the frequency of usage of a document, where usage is defined as number of times a document is opened by users through the search engine. 2. (1.5 marks each) Design a simulator for a petrol pump offering the facilities of petrol, diesel, CNG and car wash. Also give a diagrammatic representation for this simulator software. Customer arrival rates are as follows: 5 am – 6 am : 30 customers per hr. 6 am – 7 am : 50 customers per hr. 7 am – 10 am : 200 customers per hr. 10 am – 4 pm : 100 customer per hr.
Sanjay Goel, JIIT, 2006 4 pm – 8 pm : 200 customers per hr. 8 pm – 10 pm : 50 customer per hr. 10 pm – 5 am : 15 customers per hr. There are separate queues for the petrol, diesel, CNG and car wash. There are three petrol counters, two diesel counters, two CNG and one car-wash counters. 50% of the Fuel seekers purchase petrol, 25% purchase diesel and rest purchase CNG. During peak hrs., only fuel buyers are entertained. During 10 am to 6 pm, 10% customers come for car wash and rest for the fuel. Customers first buying the fuel do not go for car wash. However, 70% also buy fuel after car wash.26.09.06 1. (Group of two: 1.5 marks each) Generate as many design options as possible for 1st problem assigned in the last class. Evaluate each option for its advantages and disadvantages.28.09.061. (Group of two: 4 marks each) Design the UI, Data Characterization Catalogue, Concept Map, Data Structure, and Algorithms for following problem: We need to store up to 50000 persons and their relationships so that following queries can be efficiently addressed: i. How is x related to y? ii. To how many persons is x related? iii. Who all are related to x? iv. Who all are related to x and how? v. Who all are related to x or y? vi. How many unrelated extended families exist in the database? vii. Who is the eldest person in each extended family? viii. Who are the common persons somehow related to both x and y? ix. Who are the common persons somehow related to all x, y and z? x. How two different family charts can be merged and automatically updated in the event of marriage between the persons belonging to different family charts? 03.10.06 1. Find out the function for formula based addressing of individual elements within 2d, 3d, and kd matrices of 4 byte long integers stored in i. column major order. ii. row major order
Sanjay Goel, JIIT, 2006 In the following questions, do not waste any memory for storage of null elements in the matrix cells other than the specified sub matrices. Also write algorithms for doubling the value of user specified cell for all cases mentioned below: 2. Find out the function for formula based addressing of individual elements within 2d, 3d, and kd lower triangular matrices of 4 byte long integers stored in i. column major order. ii. row major order. 3. Find out the function for formula based addressing of individual elements within 2d, 3d, and kd upper triangular matrices of 4 byte long integers stored in i. column major order. ii. row major order. 4. Find out the function for formula based addressing of individual elements within 2d, 3d, and kd diagonal matrices of 4 byte long integers stored in i. column major order. ii. row major order 5. Find out the function for formula based addressing of individual elements within 2d, 3d, and kd tri-diagonal matrices of 4 byte long integers stored in i. column major order. ii. Row major order 6. (Group of two: 4 marks each) for any two of the above mentioned cases to be announced by Lab instructors for each batch, Write recursive program for find the following: i. Indices of the cell(s) with maximum value in matrix. ii. Sum of the cell(s) in a matrix.
Sanjay Goel, JIIT, 200605.10.06 1. (Group of two: 3 marks each) WAP for addition of two large sparse matrices (100 x 100 x 100) using Linked storage based data structures using pointer as well as simulated pointers (Sparse matrices are matrices with most elements with zero value; hence you can save large memory by avoiding the storage of zero value elements). Compare linked as well as simulated pointer based storage with formula based addressing in this context.07.10.06 1. (Group of two: 8 marks each) Enhance the scope of the people-relationship problem assigned on 28.09.06 to include following functionality: i. Find out the families in which there are more than 4 persons with postgraduate qualifications. ii. Find out the families in which more than 3 persons have been hospitalised in the last two years. iii. Find out the families in which more than 2 persons work in the same organization at same location. iv. Find out the families that collective pay annual income tax of more than Rs. 5 Lacs. v. Find out the working spouses whose work locations are in different cities with a distance of minimum 50 km. “Family” for our purpose includes direct descendants and spouses of self, parents, and father in law. Propose Data Characterization Table, Concept map, Data Structures. Also WAP for these and earlier mentioned queries. Design data structures based on at least 2 different structuring techniques.
Sanjay Goel, JIIT, 200610.10.06 (Group of two: 10 marks each without graphics, 14 marks each with animatedgraphics; Exempted for those who are doing project) Design (UI, DataCharacterization Catalogue, Concept map, Data Structures, Test plan, Algorithm),implement, and test (produce a proper Test report) a fun station simulator withfollowing specifications: In a fun-park we have a network of N-S and E-W roads. The fun park has 100auto-navigated rechargeable battery red and blue toy vehicles. Red and blue vehicles areequal in number. These toy vehicles are queued on a ramp above the ground. To beginwith, all vehicles are queued on the ramp with alternate positions being assigned to redand blue vehicles all with the initially uniform battery life of 30 minutes on the ground.The ground has a pivot point where the vehicles are landed from the ramp on the groundin an orderly manner in a randomly chosen available direction with a minimum time gapof 2 minutes. 1. Vehicles land on the ground. 2. Vehicles move in N, E, W, and S directions. 3. Vehicles turn 90 degree. Blue vehicles can turn left and red vehicles turn right. 4. If hit by a vehicle in a lane, both the vehicles reverse their direction. 5. If hit by another vehicle or the wall on a crossing, the blue vehicles turn left whereas red vehicles turn right to change their direction of movement. 6. If after a vehicle clash on a crossing, the vehicles choose to move in the same new lane, the vehicle that landed earlier on the ground moves first. 7. The vehicles continue to move till their battery is discharged. 8. Discharged vehicles are put back for charging. 9. The recharged vehicles are put back on the ramp queue. 10. Charging time depends on the vehicles waiting for charging as follows: Number of vehicles in the queue Charging time >= 50 5 minutes 30-49 10 min. 20-29 15 min. 10-19 20 min. 6-9 25 min. <=5 30 min. 11. The battery charging time is also equal to new battery life on the ground. 12. On every hit (either with wall or another vehicle), more energy is consumed and the remaining battery time of concerned vehicle(s) decreases by one minute. 13. A large robot arm (crane like) picks up the vehicles without fuel and puts them onto the queue for charging. (Bonus: 4 marks each student) Enhance this fun station with some additional special features (to be proposed by you) to make this a unique station. Maintain confidentiality about your additional features and do not show it to other students registered in this course before evaluation of all students on this assignment.
Sanjay Goel, JIIT, 200626.10.06 1. (5 marks: Exempted for those who are doing project) Write four different functions (based on different logic) for reverse order printing of information content of nodes in a linked list. Analyze the space and time complexity of your solutions.31.10.06 1. (2 marks: Exempted for those who are doing project ) WAP to convert a sorted array of 100 names into a BST. 2. (2 marks: Exempted for those who are doing project) WAP an unsorted linked list of 100 names into a BST. 3. (2 Marks: Exempted for those who are doing project) WAP to convert a BST of 100 names into a sorted linked list implemented with simulated pointer. 3. (4 marks: Exempted for those who are doing project) WAP to partition a BST of 100 names into three BSTs of nearly equal population size with non-overlapping value range.7.11.06 1. (6 marks: Exempted for those who are doing project) Write functions for non- recursive search, findmin and findmax in a BST. 2. (6 marks) Implement BST with simulated pointer and rewrite non-recursive search, insert, and delete functions for this data-structure.9.11.061. (Practice assignments not compulsory Bonus: 8 marks) Write a function for traversing binary tree by scanning it vertically right to left top to down.11.11.06 1. (Practice assignments not compulsory Bonus: 6 marks) Create an 8-ary tree using simulated pointer. Write two different kinds of traversal functions for this data structure.14.11.06 1. (Practice assignments not compulsory Bonus: 3 marks) A database stores information about hyperlinks across 1000 Websites. QUERY : If it is possible to move from xth Website to yth Website with up to two intermediate Websites in between them , then display “ link exists between xth and yth Websites” and also give sequence of names of intermediate Websites that are visited while moving from xth to yth Website ,otherwise display “No links Possible”. Propose the Data Structures and an appropriate algorithms (with and also without buffer) for processing the above Query. Also demonstrate the working of your algorithm by simulating key-steps of the algorithm for two cases e.g. A E C B.
Sanjay Goel, JIIT, 200615.11.06 1. (Practice assignments not compulsory Bonus: 3 marks) Create an 8-ary tree using formula based storage. Write two different kinds of traversal functions for this data structure.