INSTRUKSIES:   1. Die vraestel bestaan uit TWEE afde…

INSTRUKSIES:   1. Die vraestel bestaan uit TWEE afdelings:   AFDELING A Vraag 1: Literêre Teks Kinderspeletjies Totaal: 10 punte   AFDELING B  Vraag 2: Filmstudie Jou Romeo Totaal: 20 punte   GROOTTOTAAL: 30 TYD: 50 MINUTE + 10 MINUTE LEES TYD + 10 MINUTE TYD VIR INHANDIGING.   2. Beantwoord asseblief AL die vrae.   3. Die antwoorde wat jy verskaf in hierdie vraestel moet jou eie persoonlike werk wees en mag van geen ander bron gekopieer word nie.   4. Lees alle vrae noukeurig deur voordat jy dit beantwoord.   5. Die blou blokkie kan in ander “tabs” oopgemaak word om die teks te sien.   6. Relevante leestekens vir gebruik: ô ê ï ë é  

Write a function called removeFirstOf3 that removes the firs…

Write a function called removeFirstOf3 that removes the first value in successive groups of three from a list of integers, returning those values in their original order as a new list. For example if a variable called list1 stores these values: [3, 19, 7, 45, -2, 8, 6, 18, 42, 5] | | | | | | +——+ +——+ +——+ group group group Then the following call: LinkedList list2 = list1.removeFirstOf3(); Should result in list1 and list2 storing the following values: list1: {19, 7, -2, 8, 18, 42}list2: {3, 45, 6, 5} Notice that the values stored in list2 are the values that were the first value in each of the groups of three in the original list. When a list has one or two values at the end that are not part of a group of three, then the first of those values is removed and included in the new list, as with the value 5 in the example above. You are writing a member function for a linked list class defined as follows: struct ListNode { int data; // data stored in this node ListNode* next; // link to next node in the list }; class LinkedList { private: ListNode* front; public: }; You are writing a function that will become part of the LinkedList class. You may define private helper functions to solve this problem, but otherwise you may not assume that any particular functions are available. You are allowed to define your own variables of type ListNode*, but you may not construct any new nodes, and you may not use any auxiliary data structure to solve this problem (no array, vector, list, stack, queue, string, etc). You also may not change any data members of the nodes. You MUST solve this problem by rearranging the links of the list. Remember that you can access the member variables of any LinkedList, including a passed in one or newly created one, from inside the LinkedList class.

Write a function combineWith that could be added to the Set…

Write a function combineWith that could be added to the Set class from lecture. The function accepts a reference to another binary tree of integers as a parameter and combines the two trees into a new third tree which is returned. The new tree’s structure should be a union of the structures of the two original trees; it should have a node in any location where there was a node in either of the original trees (or both). The nodes of the new tree should store an integer indicating which of the original trees had a node at that position (1 if just the first tree had the node, 2 if just the second tree had the node, 3 if both trees had the node). For example, suppose Set variables t1 and t2 have been initialized and store the following trees: t1 t2 +—+ | 9 | +—+ / \ / \ +—+ +—+ | 6 | | 14| +—+ +—+ / \ \ / \ \ +—+ +—+ +—+ | 9 | | 2 | | 11| +—+ +—+ +—+ / / +—+ | 4 | +—+ +—+ | 0 | +—+ / \ / \ +—+ +—+ | -3| | 8 | +—+ +—+ / / \ / / \ +—+ +—+ +—+ | 8 | | 5 | | 6 | +—+ +—+ +—+ \ \ +—+ | 1 | +—+ Then the following call: Set t3 = t1.combineWith(t2); will return the following tree: t3 +—+ | 3 | +—+ / \ / \ +—+ +—+ | 3 | | 3 | +—+ +—+ / \ / \ / \ / \ +—+ +—+ +—+ +—+ | 3 | | 1 | | 2 | | 3 | +—+ +—+ +—+ +—+ / \ / \ +—+ +—+ | 1 | | 2 | +—+ +—+ You are writing a public function for a binary tree class defined as follows: struct TreeNode { int data; // data stored in this node TreeNode* left; // reference to left subtree TreeNode* right; // reference to right subtree }; class Set { private: TreeNode* overallRoot; public: }; You are writing a function that will become part of the Set class from lecture. You may define private helper functions to solve this problem, but otherwise you may not call any other functions of the class. You may not construct any extra data structures to solve this problem. Remember that you can access the member variables of any Set, including a passed in one or newly created one, from inside the Set class.