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:
Verified
Q20: The stack peek operation
A) checks a stack
Q21: A stack based on a linked list
Q22: A stack based on a linked list
Q23: A queue based on a linked list
Q24: In a queue implementation that uses an
Q26: Consider a class that uses the following
Q27: In an implementation of a stack based
Q28: The operation for removing an item from
Q29: Consider a class that uses the following
Q30: A queue based on a linked list
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents