Solved

A Stack Based on a Linked List Is Based on the Following

Question 28

Multiple Choice

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;
The code for implementing the operation void push(String x) can be written as


A) top = new Node(x,top) ;
B) if (top == full.
Throw new RuntimeException("Overflow".;
Else
Top = new Node(x,top.;
C) top.add(x.;
D) top = add(Node x.;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions