The code for implementing the String pop() operation is


A stack based on a linked list is based on the following code


```
class Node
{
String element;
Node next;
Node(String el, Node n)
{
element = el;
next = n;
}
}
Node top = null;

```

A)

if (top != null)
{
top = top.next;
String el = top.element;
return el;
}
else throw new RuntimeException("Empty Stack");
B)
if (top != null)
{
String el = top.element;
top = top.next;
return el;
}
else throw new RuntimeException("Empty Stack");
C)
if (top != null)
{
String el = top.element;
top = null;
return el;
}
else throw new RuntimeException("Empty Stack");
D)
return top.element;
top = top.next;

B)
if (top != null)
{
String el = top.element;
top = top.next;
return el;
}
else throw new RuntimeException("Empty Stack");

Computer Science & Information Technology

You might also like to view...

If you would like to print only the report title on the first page of a printed report, you ________

A) insert a page break above the Report Header B) insert a page break below the Report Header C) include the page number in the Report Header D) delete the Report Header

Computer Science & Information Technology

As far as Word 2013 is concerned, is there any difference between a bibliography, a works cited page, and a references page? If so, describe the difference

What will be an ideal response?

Computer Science & Information Technology