The code for implementing the operation void push(String x) can be written as

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) 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);


A) top = new Node(x, top);

Computer Science & Information Technology

You might also like to view...

In the Intel architecture, __________ mode is for systems that still run older 8086 programs.

a. protected b. virtual 8086 c. real address d. system management

Computer Science & Information Technology

Suppose this is embedded in an otherwise correct and complete program. Which version of f() will be called?

Suppose class D is derived from class B, and class B has a public member function whose declaration is void f();. Suppose class D has its version of the function, void f(). Here is a function definition and an invocation. ``` void g( B& b) { // other code b.f(); // other code }; g( dObject ); ``` a) D::f() b) B::f() c) This is illegal. You can’t pass a D object argument for a B reference parameter.

Computer Science & Information Technology

Casting a base-class pointer to a derived-class pointer is called _________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The information required by an antivirus program to find and remove a virus is called a(n) ________

Fill in the blank(s) with correct word

Computer Science & Information Technology