For the next 4 questions, write the lines of code necessary…
For the next 4 questions, write the lines of code necessary to turn the before picture into the after picture by modifying links between the nodes shown. You are not allowed to change any existing node’s data member value and you are not allowed to construct any new nodes. You are allowed to declare and use variables of type ListNode* (often called temp variables). You are writing code using the ListNode struct discussed in lecture: struct ListNode { int data; // data stored in this node ListNode* next; // link to next node in the list } As in the lecture examples, all lists are terminated by nullptr and the variables p and q have the value nullptr when they do not point to anything.
Read DetailsWrite a function called doubleMeanings that takes a referenc…
Write a function called doubleMeanings that takes a reference to an unordered_map of multi-word strings to their acronyms. Return a pointer to an unordered_set of all acronyms that represent more than one string (appear in the map more than once). For example, if a map stored the following data: {“Wisconsin Tourism Federation”=”wtf”, “intellectual property”=”ip”, “internet protocol”=”ip”, “department of aging”=”doa”, “in particular”=”ip”, “dead or alive”=”doa”, “laughing out loud”=”lol”, “what the font”=”wtf”} your function should return a pointer to an unordered_set containing: {“wtf”, “ip”, “doa”} If the map is empty or does not contain any acronyms more than once a pointer to an empty set should be returned. Do not make any assumptions about the key values in the passed in map. They could be in any order, start with any letter (not necessarily the same as their value’s first letter) and be in any casing. Do not alter the contents of the map. You may create the unordered_set your function should return a pointer to and only one other data structure to help you solve this problem. To receive full credit your solution must run in O(n) time where n is the size of the passed in map.
Read Details