Exam 16: Basic Data Structures

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

Which of the following operations from the array list data structure could be used in the implementation of the push and pop operations of a stack data structure? I addLast II addFirst III removeLast

(Multiple Choice)
4.8/5
(35)

Assume that you have a hash table in which there are few or no collisions. What is the time required to add a new element to this hash table?

(Multiple Choice)
4.7/5
(24)

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 middle of such a list? Consider the neighboring nodes.

(Multiple Choice)
4.9/5
(43)

A doubly-linked list requires that each node maintain two references, one to the next node and one to the previous node. Which of the following statements about a doubly-linked list is NOT correct?

(Multiple Choice)
4.8/5
(34)

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

Using the textbook's implementation of a linked list, which of the following statements about changing the data stored in a previously visited element is correct?

(Multiple Choice)
4.9/5
(40)

Which of the following actions must be taken to add a node X at the end 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 before the position where X will be placed III Update the list's last reference

(Multiple Choice)
4.9/5
(36)

Adding or removing an arbitrary element in the middle of an array list takes ____ time.

(Multiple Choice)
4.9/5
(33)

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 add operation?

(Multiple Choice)
4.9/5
(29)

Which of the following algorithms would be efficiently executed on a LinkedList?

(Multiple Choice)
4.7/5
(39)

Using the textbook's implementation of a linked list, what is the purpose of declaring the Node class to be a static inner class?

(Multiple Choice)
4.8/5
(28)

Suppose we maintain a linked list of length n in random element order. What would be the big-Oh notation for an algorithm that prints each list element and the number of times it occurs in the list (without sorting the list)?

(Multiple Choice)
4.9/5
(41)

Which of the following statements about array list and doubly-linked list operations is correct?

(Multiple Choice)
4.9/5
(35)

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

(Multiple Choice)
4.8/5
(37)

Given the partial LinkedList class declaration below, select a statement to complete the size method, which is designed to return the number of list elements. public class LinkedList { Class Node { Public Object data; Public Node next; } Private Node first; ) . . Public int size() { Int count = 0; Node temp = first; While (temp != null) { Count++; _____________________ } Return count; } }

(Multiple Choice)
4.8/5
(35)

Given the LinkedListQueue class implementation discussed in section 16.3 (partially shown below), select the appropriate statements to complete the add method. public class LinkedListQueue { Private Node first; Private Node last; Public LinkedListQueue() { First = null; Last = null; } Public void add(Object newElement) { Node newNode = new Node(); NewNode.data = newElement; NewNode.next = null; If (last == null) { First = newNode; Last = newNode; } Else { _____________________ _____________________ } } ).. }

(Multiple Choice)
4.8/5
(37)

A stack can be implemented as a sequence of nodes in a linked list or an array list. Which of the following statements about this is correct?

(Multiple Choice)
4.9/5
(44)

What technique is used to store elements that hash to the same location?

(Multiple Choice)
4.7/5
(30)

What type of access does the use of an iterator provide for the elements of a bucket in a hash table?

(Multiple Choice)
4.8/5
(30)

In the open addressing technique for handling collisions in a hash table, ____.

(Multiple Choice)
4.8/5
(32)
Showing 81 - 100 of 104
close modal

Filters

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