{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Midterm_takehome

# Midterm_takehome - 3d>What is a Priority queue How does...

This preview shows page 1. Sign up to view the full content.

CompE260: Take home Midterm Fall 2006 Due back at the beginning of class on 10/26/06 [60 points] 1> Write a piece of code to initialize a pointer to an array of pointers each of which points to arrays of floats where each index is initialized to 1.1. The size of the array is a run time input. [7] 2a>You have to implement “complex numbers”, i.e objects with a floating point real part and a floating point imaginary part. These objects behave like ordinary numbers except the rules of arithmetic are somewhat different (e.g.: we can solve for y in y 2 = - 1). Write a class called Complex_Numbers – identify private data members and public function members. [7] 2b>Give an equivalent struct definition of Complex_Numbers [3] [10] 3a>Define a Circular Queue ADT. [2] 3b>Define a class called Queue with relevant function members. [4] 3c>Suppose we decide to implement a Queue with no duplicate policy. How can it be done using a Linked List? How much overhead does it add – Discuss [4]
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3d>What is a Priority queue? How does it differ from a regular queue? [3] 3e>How do the interfaces between a stack and queue ADT differ? [2] [15] 4a>Describe the phenomenon of function overloading in C++ [2] 4b>How does it differ from function templates? [2] 4c>Use function template to write code for an exchange function which exchanges data value in 2 placeholders. [4] [8] 5a>Define a Binary Search Tree [2] 5b> What is lopsidedness in the context of a BST? How can you prevent it the context of deletion of a node? [3] 5c> Write pseudo code for NodeSum (BT T) that will return the sum of the integer node contents of the nodes of a binary tree T. [3] 5d> Write pseudo code for BTsrch (BT T, int x) that determines whether ‘x’ is one of the entries of T. Note that T is not a BST. [5] 5e> Write code for the same problem as in 5d> assuming T to be a BST [4] 5f> Compare the efficiencies of the searches of 5d> and 5e> [3] [20]...
View Full Document

{[ snackBarMessage ]}