University of Kwazulu Natal: School of Mathematics, Statistics & Computer Science
University of Kwazulu Natal: School of Mathematics, Statistics & Computer Science
COMPUTER SCIENCE
WESTIVILLE CAMPUS
Practical IV
Examiner: Mr E. Jembere
Duration: open
Instructions
1|Page
2. **A java Program contains various pairs of grouping symbols such as:
Parentheses ( and )
Braces { and }
Brackets [ and ]
The symbols do not overlap (e.g. (a {b)} is illegal). Write a program to check whether a
java source code file has correct pairs of the three (3) grouping symbols mentioned
above. Pass the source code file name as a command-line argument.
3. (Adding two very large Integers) A stack can be used to add two very large integers
outside the scope of int data type as shown in Figure 1.
Figure 1
4. Write a program for implementing a priority queue using a list as the underlying data
structure. Your program should aim for efficiency in the implementation of the enqueue
and dequeue operations of the priority queue.
----------------------------------------------------------------------------------------------------------------
2|Page