Advanced Java Midterm2

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following operations is performed more efficiently by doubly linked list than by singly linked list?

Deleting a node whose location is given

Forgetting to set the reference instance variable of the last node in a linked list to null will cause a compile-time error. (program will not compile.)

False

When using a linked list, you do not need to know when the end of the list has been reached.

False

Consider a singly linked list of n elements. What is the time taken to insert an element after an element pointed by some pointer?

O(1)

The time required to delete a node x from a doubly linked list having n nodes is

O(1)

In a binary search tree, where the root node key = 34, what do we know about the keys of all the descendents in the left subtree of the root?

all will be < 34

What does the left node reference get set to in a newly inserted binary tree node?

always null

Recursively visiting the left subtree, right subtree and then the root describes:

postorder processing

Recursively visiting the root node, left subtree and then the right subtree describes:

preorder processing

node is the first node in the tree data structure.

root

A linear list in which the pointer points only to the next node is

singly linked list

The operation of processing each element in the list is known as

traversal

A node of binary tree has exactly _________ link instance variables.

two

Consider a List that implements an unordered list. Suppose it has as its representation a singly linked list with a head and tail pointer (i.e., pointers to the first and last nodes in the list). Given that representation, which of the following operations could be implemented in O(1) time?

1. Insert item at the front of the list 2. Insert item at the rear of the list 3. Delete front item from list

A binary search tree is made up of a collection of nodes organized with smaller keys on the left and greater keys on the right relative to any node. Which of the following Node references must be attributes of any implementation of Node class?

II left III right

linked list that has nodes that contain two references to Nodes.

doubly

maps a data value such as a String into a number:

hash function


Conjuntos de estudio relacionados

Chap 3 3.3 a membrane seperates each cell from its surrounding

View Set

Anatomical Features (Markings) of Bones

View Set

Title IX and Gender Issues in Sports

View Set

Chapter 4: Folk and Popular Culture Test Review

View Set

Foundation and practice of mental health nursing

View Set

Questions I Got Wrong on the Practice - AP Human Geography

View Set