Business & Technology | Math & CS | Dr. Aaron R. Rababaah | CSDP 250 | Final (Fall-2015) full paper solution

Implementation Language

If code is given or required, it should be in C++

Question [01]

Given the structure:
struct BankAcnt{
string name;
int number;
float balance;
};

Write a search function that scans a passed array of BankAcnt type to find an account with a passed number and resets the account balance to zero and returns “true”. If the account is not found, it just returns “false”. The operator “[]” is not allowed anywhere in the function and the size of the array is unknown but, the array always maintains a sentinel BankAcnt with a (number = -1).

Question [02]  

Given the STL two containers: forward_list and stack, write two functions to:
a) Reverse print the objects of a forward_list using recursion.
b) Reverse print the objects of a forward_list using iteration and stack.


Question [03] 

Write a function that prints a <queue> elements in reverse order using any helper STL container but the <stack>.

Question [04] 

Given a singly-linked list template class write the implementation code of “bool deleteNode(T& obj)”. Assume that the “==” is overloaded in T.

Question [05]

Given a doubly-linked list template class write the implementation code of “bool deleteNode(T& obj)”. Assume that the “==” is overloaded in T.

Question [06] 

Write a template function that implements recursive linear search. Assume that the “==” is overloaded in T.

Question [07] 

Write a recursive search function member of the template class “ChainedHashTable”.

Question [08] 

1. .
2. .
3. .
4. .
5. .
6. .
7. .
8. .
9. .
10. .11. . template <class Type>
void queueType<Type>::addQueue(const Type* newElement)
{
if (isFullQueue){
queueRear = (queueRear + 1) % maxQueueSize;
count--;
list(queueFront) = newElement;
}
else
cout << "Cannot add to a full queue." << endl;
}

a) Explain Line (5).
b) Find and correct any syntactical or logical errors.


Question [09] 

Write a recursive “insert” function member of the template class “BinSearchTree”.

Question [10] 

Write a recursive “average” function member of the template class “BinSearchTree”.

Question [10] 

Write a recursive max() function member of the template class “BinSearchTree”.

Question [11] 

Given the three sorting algorithms: Quick, Merge, and Heap sort, do the following:
1) Analyze their T(n) as a big O for worst and best case scenario.
2) Write the main concept of each in no more than three lines.

Question [12]

For each of the following, give and justify the most efficient data structure and algorithm to solve the given problem:
a) A dynamically sorted table is needed to maintain information of 100 employees using their SSN.
b) A dynamic unsorted table is needed to maintain information of 100 items using 16-char string ID.
c) A dynamic data structure is needed to manage a waiting line for an emergency service at a hospital. The patients have different priorities depending on their health urgency.
Note: Dynamic implies frequent insertion and deletion.

Get Project Solution Now

Comments