Data Structures Flashcards

(7 cards)

1
Q

Linked List

A

consists of nodes where each node contains a data field and a link to the next node in the list

LinkedList list = new LinkedList();

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

Stack

A

linear data structure following LIFO order (last in, first out)

Stack stack = new Stack();

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

Queue

A

linear data structure following FIFO order (first in, first out)

Queue q = new LinkedList<>();

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

Priority Queue

A

every item has priority associated to it
item with greatest priority is dequeued first

PriorityQueue pQueue = new PriorityQueue();

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

Comparator (Priority Queue)

A

can change order of priority:

Comparator stringLengthComparator = new Comparator() {
            @Override
            public int compare(String s1, String s2) {
                   return s1.length() - s2.length();
            }
};

pass into priority queue

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

2D Array

A

arrays of arrays

int[row][column] x = new int[10][10]

int row = x.length
int column = x[0].length

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

Hash Map

A

stores values in key/value pairs

HashMap map = new HashMap<>();

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