Data Structures 5 Flashcards
The reference of the head of the doubly linked list is passed to the reverse() method:
1<–>2<–>3<–>4<–>5<–>6
What is the modified linked list when complete?
6<–>5<–>4<–>3<–>2<–>1
Which data structure is indexed?
Array
Which data structure may only store homogeneous data elements?
Arrays
What is a hierarchical data structure?
Tree
What is an attribute of a binary tree?
Each node has at most two children.
Which data structure uses a last in, first out (LIFO) removal of items?
Stack
Given:
heapList = [22, 33, 44, 55, 66]
Which index is the right child of item 22?
44
What is the logical first step in an algorithm that extracts all the positive values from a given list of numbers?
Initialize the result to an empty list
What is displayed when n = 2 in this pseudocode?
for(int i = 2; i <= n; i++){
for(j = 0; j <= n;){
display j;
j = j + n/2; the division is integer division, decimal part neglected
}
}
0, 1, 2
Given a set of numeric data and two declared variables: small and max, what is the logical first step in an algorithm that finds the smallest number?
Checking that the list contains at least one number