VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
Assignment 2
1. Data Structure & Algorithms CMP-3112
Ms. Eisha
Assignment 2
Instructions:
You have to write generic code for all the programs. Examples given along with the
questions are only for reference/understanding.
You can help each other but do not copy assignment. In case of PLAGIARISM,
assignment of both the students will be marked as ZERO.
Deadline for assignment submission is October 25, 2016 11:59 PM. NO ASSIGNMENT
WILL BE ACCEPTED AFTER DEADLINE.
You have to submit the assignment in a zip folder renamed with your section & Roll# as
Sec A_Roll#1
You have to email your assignment at eisha39c@yahoo.com with subject e.g. “Section A,
Roll# 1”
1. Consider a Telephone system that can store up to 10 numbers of most recent callers. Once
the system reaches the limit it deletes the number of least recent caller. Also the system
also have an automatic redial feature that allows the user to redial the last number
automatically if he has lastly called the number himself, but if he ignored the number or
disconnects the number, the user can’t redial the number using the redial feature. Write a
code to design the same system using an appropriate data structure that allows the user to:
i. Dial any number
ii. Redial any number
iii. Ignore/disconnect number
iv. Show the history of 10 called numbers from the most recent one to old.
2. Write a program that takes a word from the user and at the end shows that whether the
word is a palindrome or not. (Use stack to implement the program)
3. Write a program that reads in a sequence of characters, and determines whether all the
parentheses, braces, and curly braces are "balanced."
4. Write a program that reads in a positive integer and prints the binary representation of
that integer. (Use stack or queue to implement the program)
5. Implement a queue with two stacks.
6. Implement priority queue.
7. Convert the following infix expression to prefix expressions:
i. (a + b )*(c + d ) + e – f/g*h + 3.25
ii. (a + b – k + l) * (c + d) + e
iii. A + ((( B – C ) * ( D – E ) + F ) / G) / ( H – J)
8. Convert the following infix expression to postfix expressions:
i. ((((1^2)*3)–4)+((5/6)/(7+8)))/2*2+1
ii. (A+B)*(C$(D–E)+F)–G
iii. (4+8)*(6–5+1)/((3–2)*(2+2+3+1))