Question: The stack pop operation Question 9 options: removes from the stack the number of elements specified by its integer parameter removes all items currently on

The stack pop operation

Question 9 options:

removes from the stack the number of elements specified by its integer parameter

removes all items currently on the stack

extracts one element from the stack and returns it

does not exist: There is no such stack operation

Question 10 (2 points)

The stack pop operation Question 9 options: removes from the stack the

Consider a class that uses the following variables to implement an array-based stack: String [ ] s = new String[100]; int top = 0; The boolean method to check for an empty stack can be written as:

Question 10 options:

if (s == null) return true; else return false;

if (s.length == 0) return true; else return false;

return top;

if (top == 0) return true; else return false;

Question 11 (1 point)

number of elements specified by its integer parameter removes all items currently

The operation for removing an item from a queue is called

Question 11 options:

disqueue

enqueue

dequeue

extract

Question 12 (1 point)

on the stack extracts one element from the stack and returns it

A queue based on a linked list uses the following code class Node{ String element; Node next; Node (String el, Node n) { element = el; next = n; } } Node front = null, rear = null; What is the right code for String remove() operation? Such an operation removes and returns an element from the queue.

Question 12 options:

if (front == null) throw new RuntimeException("Empty"); String temp = front.element; front = front.next; if (front == null) front = rear; return temp;

if (rear== null) throw new RuntimeException("Empty"); String temp = rear.element; rear = rear.next; if (front == null) rear = null; return temp;

if (front == null) throw new RuntimeException("Empty"); String temp = front.element; front = front.next; if (front == null) rear = null; return temp;

if (front == rear) throw new RuntimeException("Empty"); String temp = front.element; front = front.next; if (front == null) rear = null; return temp;

Question 13 (1 point)

does not exist: There is no such stack operation Question 10 (2

The predecessor of a node in a binary tree is called its

Question 13 options:

precursor

progenitor

ancestor

parent

Question 14 (1 point)

points) Consider a class that uses the following variables to implement an

In a binary tree,

Question 14 options:

there must be exactly one node with no predecessor

there may be at most two nodes with no predecessor

there must be at most one node with no predecessor

there may be any number of nodes with no predecessor

Question 15 (1 point)

array-based stack: String [ ] s = new String[100]; int top =

The successor of a node in a binary tree is called its

Question 15 options:

neighbor

descendant

neighbor

child

Question 16 (1 point)

0; The boolean method to check for an empty stack can be

An empty binary tree has height

Question 16 options:

-1

1

0

None of the above: the height of an empty binary tree is not defined.

Question 17 (2 points)

written as: Question 10 options: if (s == null) return true; else

An AVL tree is

Question 17 options:

a priority queue with a balance condition

a binary search tree in which the heights of the subtrees at each node differ by at most one

a binary tree in which the left and right subtree have heights that differ by at most one

a binary tree in which each child is greater than its parent

Question 18 (2 points)

return false; if (s.length == 0) return true; else return false; return

A priority queue is

Question 18 options:

a binary search tree in which the heights of the subtrees at each node differ by at most one

is an AVL tree in which the root is the minimum element

is a collection that allows elements to be added, but only allows the minimum element to be removed

is a binary search tree that stores elements according to their natural order

Question 19 (1 point)

top; if (top == 0) return true; else return false; Question 11

A complete binary tree with N nodes has depth approximately equal to

Question 19 options:

log N

2N

N

N2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!