Data Structures (4.2 - Part 2) Flashcards

1
Q

Stack

A

Data structure where items are always added/removed from top

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

What type of data structure is stack?

A

FILO

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

2 data structures which can be used to implement stacks

A

Arrays and linked lists

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

push ()

A

Adds item to top of stack

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

pop ()

A

Removes and displays item at top of stack

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

peek ()

A

Displays item at top of stack without removing it

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

isEmpty ()

A

Checks to see if stack is empty

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

isFull ()

A

Checks to see it stack is full

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

When do stack overflows occur?

A

When attempting to push item onto stack that is already full

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

In which type of stacks do overflows occur?

A

Static

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

How do trees represent data?

A

Hierarchically

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

2 rules for creating trees

A
  • Each node must be connected to 1 parent node and 1 or more children
  • There should be no direct connections between nodes on same level of hierarchy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

3 ways to traverse tree structure

A
  • Pre-order
  • In-order
  • Post-order
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pre-order traversal

A

Starts from root node and visits all following nodes from left to right

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

In-order traversal

A

Starts with nodes on left subtree, then visits root node and then goes to right subtree

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

Post-order traversal

A

Starts with left subtree (from bottom to top), then goes to right subtree (also bottom to top) and finishes at root node

17
Q

Binary search tree

A

Tree data structure used for efficient searching of data

18
Q

Difference between binary search trees and trees

A

Binary search trees can have no more than 2 child nodes

19
Q

When does binary search tree store child node to left side?

A

When node is less than other node

20
Q

When does binary search tree store child node to right side?

A

When node is greater than other noe