6 Questions on Algorithm and Data Structure - Assignment 1 | CS 303, Assignments of Computer Science

Material Type: Assignment; Class: Algorithms and Data Structures; Subject: Computer Science; University: University of Alabama - Birmingham; Term: Spring 2004;

Typology: Assignments

Pre 2010

Uploaded on 04/12/2010

koofers-user-gfu-1
koofers-user-gfu-1 🇺🇸

3.5

(2)

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT #1
Due Tuesday, January 6, 2004, 11:20 A. M.
Fill in the Blank.
1. Name:
2. I have satisfied the prerequisites of CS 303 Algorithms and Data Structures and CS 350
Formal Languages and Automata, each with a grade of C or better.
Signature:
True or False.
For each of the problems below, indicate whether it is true or false. Justify your answer in either
case.
3. A context-free grammar defining a deterministic context-free language may always be con-
verted into a deterministic pushdown automaton.
4. The context-free grammar below is ambiguous.
Sif (e) S|if (e) Selse S|s
5. It is not possible to implement a tree data structure where interior nodes have an arbitrary
number of children (e.g. some nodes may have 1 child, some 2, some 3, etc.).
Short Answer.
6. Assume a binary tree object with functions value,left and right to return the value of
the current node, left subtree, and right subtree, respectively. Using an actual programming
language or pseudo-code, write a function postorder to print the values of all nodes in the
tree using a post-order traversal. Please write your answer on back.

Partial preview of the text

Download 6 Questions on Algorithm and Data Structure - Assignment 1 | CS 303 and more Assignments Computer Science in PDF only on Docsity!

ASSIGNMENT

Due Tuesday, January 6, 2004, 11:20 A. M.

Fill in the Blank.

  1. Name:
  2. I have satisfied the prerequisites of CS 303 Algorithms and Data Structures and CS 350 Formal Languages and Automata, each with a grade of C or better.

Signature:

True or False.

For each of the problems below, indicate whether it is true or false. Justify your answer in either case.

  1. A context-free grammar defining a deterministic context-free language may always be con- verted into a deterministic pushdown automaton.
  2. The context-free grammar below is ambiguous. S → if (e) S | if (e) S else S | s
  3. It is not possible to implement a tree data structure where interior nodes have an arbitrary number of children (e.g. some nodes may have 1 child, some 2, some 3, etc.).

Short Answer.

  1. Assume a binary tree object with functions value, left and right to return the value of the current node, left subtree, and right subtree, respectively. Using an actual programming language or pseudo-code, write a function postorder to print the values of all nodes in the tree using a post-order traversal. Please write your answer on back.