FinalPractice - CSC 4005 Fall 2007 Practice problems for...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Fall 2007 Practice problems for the Final Draw a (single) binary tree T such that Each internal node of T stores a single character. A preorder traversal of T yields GOHAWKS. An inorder traversal of T yields AHWOKGS. Let T be a binary tree. If T has 7 nodes, what is its minimum height? What is its maximum height? Draw two trees that achieve the minimum and maximum height, respectively. Give pseudo-code for concatenating two concrete singly linked lists L and M with head sentinels (no tail) into a single list L that contains all the nodes of L (in their original order) followed by all the nodes of M (also in their original order). The Frst node in a linked list could be obtained by the head() method. You can use getNext(), setNext(. ..) methods of the Node class. What is the running time of your method if we let n denote the number of nodes in L and we let m denote the number of nodes in M? Write a Java program to convert a postFx expression to inFx. Use a Stack. Write a method that would reverse a Queue using a Stack. You are given a LinkedList storing String objects in sorted order (increasing order). Write a Java method, insert(LinkedList alist, String newStr) that would insert a new String object into the linked list preserving the list’s order. You SHOULD use a ListIterator for the linked list and methods of the ListIterator interface when writing your method. You are given a LinkedList storing String objects . Write a Java method, replace(LinkedList alist, String oldStr, String newStr) that would replace the oldStr with the newStr in the linked list. You SHOULD use a ListIterator for the linked list and methods of the ListIterator interface when writing your method. Write a Java method that would print the contents of a Queue object. The
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

FinalPractice - CSC 4005 Fall 2007 Practice problems for...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online