Write a function evenSum that could be added to the LinkedLi…

Write a function evenSum that could be added to the LinkedList class from lecture that returns the sum of the values in even indexes in the list of integers. Assume we are using 0-based indexing where the first value in the list has index 0, the second value has index 1 and so on. The values we are interested in are the ones with even indexes (the value at index 0, the value at index 2, the value at index 4, and so on). For example, suppose that a variable named list stores this sequence of values: {1, 7, 2, 2, 39, 45, 40, 5} then the call: list.evenSum() should return the value 82 (1 + 2 + 39 + 40). Notice that what is important is the position of the numbers (index 0, index 2, index 4, etc), not whether the numbers themselves are even. If the list is empty, your function should return a sum of 0. Assume that we are adding this function to the LinkedList class as seen in lecture and as shown below. You may not call any other functions of the class to solve this problem. class LinkedList { private: ListNode* front; }

Write the output produced by the following function when pas…

Write the output produced by the following function when passed each of the following queues: Assume that a stack prints in {bottom, …, top} order, a queue displays in {front, …, back} order and maps print as {key1=value1, … keyN=valueN}. void mystery(queue& q) { stack s; map m; int oldSize = q.size(); for (int i = 0; i < oldSize; i++) { if (i % 2 == 0) { q.push(q.front()); q.pop(); } else { s.push(q.front()); q.pop(); } m = i; } for (int i = 0; i < oldSize; i++) { if (i % 2 == 0) { q.push(q.front()); q.push(m); q.pop(); } else { q.push(s.top()); s.pop(); } } cout