Assignment No. 1
Semester: Fall 2016
CS301 – Data Structures
Total Marks: 20
Due Date:November 16, 2016
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/ to from students).
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file if needed. Keep all your files (word and .cpp) in a folder and make its zipped file to upload on LMS.
Note:Use ONLY Dev-C++ IDE for writing and executing your code.
The purpose of this assignment is to make you familiar with following topics:
• Singly Linked List, Double Linked List and Circular Linked List Infix to Postfix
• C++ Templates
• Implementation of Stack
• Function Call Stack
Assignment Submission Instructions
You have to submit only word file on the Assignments interface of CS301 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.
Question 1: [10 marks]
Given is a code of abstract class declaration for a list (ADT) in Figure 1(a).
a) Assume a list has the following configuration:
< | 2, 23, 15, 5, 9 >.
Write only Method calls (Name of function) using the List ADT of Figure 1(a) to delete the element with value 15.
e.g To move the pointer to end of the list We will use function movetoEnd( ). No need to write function implementation.
Note: Here the ‘|’ symbol represents ‘fence’ like pointer that indicates the current position of pointer in list.
b) Show the list configuration resulting from each series of list operations using the List ADT of Figure 1(a) Assume that list L1 is empty at the beginning of each series. Show where the fence is in the list.
Question 2: [10 marks]
Given is an infix expression:
A + B * C / (D-B)
Write a complete program in C++ to convert the above infix expression into postfix notation.
Your assignment must be uploaded on or before November 16, 2016. We shall not accept your solution through email after the due date.