Data Structures 5 Flashcards

1
Q

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?

A

6<–>5<–>4<–>3<–>2<–>1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which data structure is indexed?

A

Array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which data structure may only store homogeneous data elements?

A

Arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a hierarchical data structure?

A

Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an attribute of a binary tree?

A

Each node has at most two children.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which data structure uses a last in, first out (LIFO) removal of items?

A

Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Given:

heapList = [22, 33, 44, 55, 66]

Which index is the right child of item 22?

A

44

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the logical first step in an algorithm that extracts all the positive values from a given list of numbers?

A

Initialize the result to an empty list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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
}
}

A

0, 1, 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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?

A

Checking that the list contains at least one number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly