Exercises (5 marks)
Write a recursive method to compute the number of elements in a queue.
Write a recursive method to check whether a given string is palindrome.
Write a recursive method to add the first n terms of the series 2345.
Exercises:
What does mysteryMethod do?
void mysteryMethod(Node n, int val1, int val2) {
if (n.data == val1) {
Node node = new Node(val2);
node.next = n.next;
n.next = node;
return;
}
mysteryMethod(n.next, val1, val2);
}