List Adt Flashcards

1
Q

Implementing an ArrayList involves…

A

private Object[] elementData
private int size

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

Inserting in a list involves…

A

Use a for loop from i < size() of the array -1
The data is shifted right
size++

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

Removal in a list involves…

A

Use a for loop from i + 1 size() - 1 are shifted left by an index size–

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

When an array is full the process involves…

A

Element data points to a new array with a size increased by 50%.
All current n elements are copied

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

Which ADT uses LIFO?

A

Stacks(Last in First Out)

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

Which ADT uses FIFO?

A

Queue(First In First out)

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

What is the index pointer for a circular array?

A

tail = (head + size - 1) % length

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

What are the 3 types of lists?

A

Unordered Lists
Ordered Lists
Indexed Lists

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

Do indices need to start at zero for a list?

A

No it is an ADT not an array

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

What does the add(index, dataItem) do?

A

adds the data item at the specified index

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

What does the set(index, dataItem) do?

A

Sets dataitem at the specified index overwriting any data that was there

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

What does the remove(index) do?

A

Removes and returns the data item at the specified index

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

what does the indexOf(dataItem) do?

A

Returns the index of dataItem

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