main Flashcards

1
Q

stack

A

LIFO
to implement a stack you need to maintain a pointer at the top of the stack which is the last element to be added

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

stack operations

A

push(item) adds a new item to the top of the stack
pop() removes and returns the top item from the stack
peek() returns the top item from the stack but does not remove it
IsEmpty() tests to see if the stack is empty
IsFull checks if the stack is full and returns a boolean value

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

queue

A

FIFO
size of queue determines on the number of items in it

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

queue operations

A

enqueue(item) adds a new item to the end of the queue
dequeue() removes the first item from the queue and returns it
IsEmpty() tests to see where queue is empty
IsFull tests to see whether queue is full

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

Tree

A

root at top, leaves at the bottoms

a tree is only a binary tree a node can only have two children

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

graph structure

A

undirected or directed
has vertices
directional or bi-directional

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

how to delete leaf node in tree

A

Search tree until the required node is found
Set the parent node pointer to the leaf node to null

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