Академический Документы
Профессиональный Документы
Культура Документы
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 {
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)