1.Show the list configuration resulting from each series of list operations using the List ADT of Figure 4.1 and the list notation described by the author in Section 4.1 of your text. For example, < 20, 23 | 12, 15> describes a list consisting of values 20, 23, 12, and 15 in that order and the current position is at value 12. Assume that lists L1 and L2 are empty at the beginning of each series. Show where the current position is in the list.
(a)
L1.append(10);
L1.append(20);
L1.append(15);
(b)
L2.append(10);
L2.append(20);
L2.append(15);
L2.moveToStart();
L2.insert(39)
L2.next();
L2.insert(12);
2.Traversals - Modify the following preorder traversal to perform an inorder traversal of a binary tree.
template < typename E>
void preorder(BinNode< E>* root) {
if (root == NULL) return; // Empty subtree, do nothing
visit(root); // Perform desired function
preorder(root->left());
preorder(root->right());
}
"template < typename E>" "void preorder(BinNode< E>* root)"
3.What is a K-ary tree and what distinguishes it from general trees?