What is the functionality of the following piece of code?
public int function()
{
Node temp = tail.getPrev();
tail.setPrev(temp.getPrev());
temp.getPrev().setNext(tail);
size--;
return temp.getItem();
}
public int function()
{
Node temp = tail.getPrev();
tail.setPrev(temp.getPrev());
temp.getPrev().setNext(tail);
size--;
return temp.getItem();
}A. Return the element at the tail of the list but do not remove it
B. Return the element at the tail of the list and remove it from the list
C. Return the last but one element from the list but do not remove it
D. Return the last but one element at the tail of the list and remove it from the list
Answer: Option D
Related Questions on Introduction to Data Structures
A. A collection of data values
B. A programming language
C. A set of algorithms
D. A way of organizing and storing data

Join The Discussion