Exam 16: Basic Data Structures

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

Consider the following code snippet, which computes h, the array index for storing x in a hash table. Int h = x.hashCode(); If (h < 0) { h = -h; } H = h % size; What does size correspond to?

(Multiple Choice)
4.8/5
(35)

Complete the following code snippet, which is intended to compress a hash code to become a valid array index: Int h = x.hashCode(); If (h < 0) { h = -h; } _______________

(Multiple Choice)
4.9/5
(40)

Suppose we maintain a linked list of length n in random element order. What would be the big-Oh notation for printing out those elements which occur exactly once in the list (without sorting the list)?

(Multiple Choice)
4.9/5
(45)

Suppose we maintain two linked lists of length n in sorted order. What would be the big-Oh notation for the creating a third list, which included only elements common to both lists?

(Multiple Choice)
4.7/5
(40)

The advantage of using the open addressing technique over the separate chaining technique for handling collisions in a hash table is that open addressing ____.

(Multiple Choice)
4.8/5
(34)

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.8/5
(45)

When considering the reallocation operation for a list whose buffer is full, on average it will take ____ time.

(Multiple Choice)
4.9/5
(38)

What is never present in a static inner 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 the linked list is correct?

(Multiple Choice)
4.8/5
(31)

The ___ technique for handling collisions in a hash table with open addressing attempts to place colliding elements at the next available location in the hash table.

(Multiple Choice)
4.8/5
(40)

Assume that you have a hash table in which there are an average number of collisions. What is the time required to add an element to this hash table?

(Multiple Choice)
4.9/5
(41)

If we want a create a doubly-linked list data structure so that we can move from a node to the next node as well as to a previous node we need to add a previous reference to the Node class. Each such DNode (doubly-linked Node) will have a data portion and two DNode references, next and previous. How many references need to be updated when we remove a node from the beginning of a list with many nodes? Consider the first reference and neighboring node(s).

(Multiple Choice)
4.8/5
(35)

When using the textbook's implementation of a singly linked list to remove an element in the middle of the list, why it is necessary to check whether the previous reference equals the position reference?

(Multiple Choice)
4.8/5
(32)

A hash function is considered good if it ____.

(Multiple Choice)
4.8/5
(40)

What is included in a linked list node? I a reference to the next node II an array reference III a data element

(Multiple Choice)
4.8/5
(38)

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) { throw new NoSuchElementException(); } Object element = first.data; ________________ ________________ } ) . . }

(Multiple Choice)
4.9/5
(39)

Array list operations that were studied included adding/removing an element at the end or in the middle, and retrieving the kth element. Which of the following statements about these array list operations is correct?

(Multiple Choice)
4.9/5
(35)

Assume that you have a hash table in which there are an average number of collisions. What is the time required to remove an element from this hash table?

(Multiple Choice)
4.7/5
(34)

An array list maintains a reference to an array of elements called a ____.

(Multiple Choice)
4.7/5
(35)

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

(Multiple Choice)
4.8/5
(33)
Showing 41 - 60 of 104
close modal

Filters

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