Exam 16: Basic Data Structures

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Which of the following actions must be taken to add a node X at the beginning of a doubly-linked list? I Update the next reference in the node before the position where X will be placed II Update the previous reference in the node after the position where X will be placed III Update the list's first reference

(Multiple Choice)
5.0/5
(43)

Linked list operations that were studied included adding/removing an element at the end or in the middle, and retrieving the kth element. If the iterator is currently pointing to the correct location for insertion or removal, which of the following statements about these doubly-linked list operations is correct?

(Multiple Choice)
4.7/5
(42)

Which Java package contains the LinkedList class?

(Multiple Choice)
4.8/5
(39)

Assume that the linked list implementation includes a reference to the last node as well as to the first node. Which of the following statements about the efficiency of a singly linked list is NOT correct?

(Multiple Choice)
4.8/5
(34)

If your hashCode function returns a number anywhere in the hash table with equal probability, what is the likely result?

(Multiple Choice)
4.8/5
(30)

Which of the following statements about using iterators with hash tables is NOT correct?

(Multiple Choice)
4.9/5
(42)

What feature of the ArrayList class makes it much better for a binary search than the LinkedList class?

(Multiple Choice)
4.8/5
(36)

Which statement about handling collisions in a hash table using the open addressing technique is NOT correct?

(Multiple Choice)
5.0/5
(46)

Suppose we maintain a linked list of length n in sorted order. What would be the big-Oh notation for printing out those elements that occur exactly once in the list?

(Multiple Choice)
4.9/5
(46)

Why is it not typical to use the hashCode method result directly as an index for array storage? I because the hashcode method returns a double II the values are potentially very large III the values are not type int

(Multiple Choice)
4.8/5
(41)

Adding or removing an element at an arbitrary iterator position in a singly linked list of length n takes ____ time.

(Multiple Choice)
4.9/5
(42)

Insert the missing code in the following code fragment. This fragment is intended to remove a node from the head of a linked list: public class LinkedList { ) . . Public Object removeFirst() { If (first == null) { ________________ } Object element = first.data; First = first.next; 1 Return element; } ) . . }

(Multiple Choice)
4.7/5
(38)

Given the partial LinkedList class declaration below, select an expression to complete the empty method, which is designed to return true if the list contains no elements. public class LinkedList { Class Node { Public Object data; Public Node next; } Private Node first; ) . . Public boolean empty() { Return ________________________ ; } }

(Multiple Choice)
4.8/5
(32)

You have implemented a queue as a singly-linked list, adding elements at the end and removing elements at the front. What is the cost of the remove operation?

(Multiple Choice)
4.8/5
(32)

Given the partial ArrayList class declaration below, select an expression to complete the empty method, which is designed to return true if the list contains no elements. public class ArrayList { Private Object[] elements; Private int currentSize; Public ArrayList() { Final int INITIAL_SIZE = 10; Elements = new Object[INITIAL_SIZE]; CurrentSize = 0; } Public boolean empty() { Return ________________________ ; } }

(Multiple Choice)
4.8/5
(38)

Which of the following statements about hash tables is NOT correct?

(Multiple Choice)
4.9/5
(47)

On average, how many elements of an array list of size n need to be moved when an element is removed?

(Multiple Choice)
4.9/5
(28)

Which of the following actions must be taken to remove a node X from the middle of a doubly-linked list? I Update the next reference in the node before X II Update the previous reference in the node after X III Update the list's first reference

(Multiple Choice)
4.8/5
(40)

Using the textbook's implementation of a linked list, which of the following statements about adding a node to the middle of a linked list is correct?

(Multiple Choice)
4.9/5
(40)

In the separate chaining technique for handling collisions in a hash table, ____.

(Multiple Choice)
4.9/5
(30)
Showing 61 - 80 of 104
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)