b Write pseudo code for a merge of two containers that performs an intersection

# B write pseudo code for a merge of two containers

This preview shows page 3 - 5 out of 5 pages.

(b) Write pseudo-code for a merge of two containers that performs an intersection of the containers. [4 + 6 = 10] 7. (a) Draw diagrams showing the steps involved in swapping the order of two nodes in a linked list. (b) Write down the C++ code for a method that does a linear search on a linked list of integers. You may assume all the normal Node methods exist. The method is to return true or false (function-wise) depending on whether the integer is found. [4 + 6 = 10]
B209 Data Structures and Abstractions EXAM 4 8. (a) Draw a copy of the diagram below, with labels/additions showing the meaning of the terms: i. edge ii. vertex iii. a tour (b) Draw the Adjacency List for the graph below: 2 0 1 3 4 5 6 [3 + 7 = 10] 9. (a) Write a paragraph briefly describing the observer design pattern. (b) Assuming that we have three classes derived from an Account class and that the user has chosen a number from the following menu: TYPE OF ACCOUNT 0 - Standard 1 - Savers 2 - Overdraft Write the C++ code for the following factory method: Account *GetAccount(int menuChoice); [3 + 7 = 10]
B209 Data Structures and Abstractions EXAM 5 10. (a) Given the following definition for a node: class Node { public: Node () {m_left = m_right = NULL;} ~Node () {}; Node *GetLeft () {return m_left;} Node *GetRight () {return m_right;} void SetLeft (Node *left) {m_left = left;} void SetRight (Node *right) {m_right = right;} bool operator < (Node *other) {return data < other-\$>\$data;} bool operator > (Node *other) {return data > other-\$>\$data;} private: Node *m_left; Node *m_right; Data m_data; } write C++ code for the following—recursive—Binary Search Tree method, that inserts a new node in the sub-tree below the parent node: void TreeClass::Insert(Node *parent, Node *newNode); You may assume that there will be no duplicate data. (b) Draw the diagram of the 3-way, B-tree that results after the following numbers are inserted into an initially empty tree: 45, 23, 78, 14, 9, 22. [5 + 5 = 10] ——– ♦♦♦ END OF PAPER ♦♦♦ ——–

#### You've reached the end of your free preview.

Want to read all 5 pages?