main Flashcards
stack
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
stack operations
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
queue
FIFO
size of queue determines on the number of items in it
queue operations
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
Tree
root at top, leaves at the bottoms
a tree is only a binary tree a node can only have two children
graph structure
undirected or directed
has vertices
directional or bi-directional
how to delete leaf node in tree
Search tree until the required node is found
Set the parent node pointer to the leaf node to null