Вы находитесь на странице: 1из 1

Homework on Stacks/Linked Lists/Queues

Q1.
a) Implement a stack whose elements will be single characters. (10 pts)
b) In this part you will use the stack implementation you developed in
part (a) to implement a simple parser: delimiter matching. Delimiters
are braces { and }, brackets [ and ], and parentheses ( and
). Given an input string containing a set of characters together with
delimiters, your program should determine whether delimiters match
or not. Examples are:

c[d] : correct
a{b[c]d}e : correct
a{b(c]d}e : not correct; ] does not match (
a[b{c}d]e} : not correct; the last character } does not have an
opening {
a{b(c) : not correct; nothing matches opening {

Your programs input will be a set of characters with delimiters. The


output will be a validation answer: correct or not; if not correct, the reason
why. (15 pts)

Q2. In the lecture notes pseudocode for a singly linked lists basic
operations are provided. In this exercise you will work on a doubly linked-list.
a) Write pseudocode for the basic operations (insert a new element,
delete an element, find an element, and traverse the list) on a doubly
linked-list. (10 pts)
b) Implement a doubly linked-list with its basic operations in your favorite
programming language. (15 pts)

Вам также может понравиться