what is a linked list
linear collection of self referential structures (nodes) connected by pointer links
how to delete a node from binary search tree (3 cases)
applications of stacks
what is difference between non-binary and binary tree
non-binary: can have any # of children
binary: only can have 2 children (left & right)
operations for queues
enqueue()
dequeue()
variants of queues
what are the types of tree traversal and how do each of them work?
operations for stacks
push()
pop()
isEmpty()
size()
what is a binary tree
either empty (null pointer), or is made of a single node, where left & right pointers each point recursively to a smaler binary subtree
how do stacks work
last-in-first-out (LIFO)
3 types of linked lists?
what do you use inorder, preorder, and postorder traversal of binary trees for?
what is the max # nodes at a given level of binary tree
2^(level-1)
eg. max # nodes at level 2 = 2^1 = 2 nodes
what is a binary search tree
how to insert an item into a binary search tree
if value less than
go left
else
go right
applications of queues
what are infix, prefix, postfix
how do queues work
first-in-first-out (FIFO)
features of an abstract data type
Its (behaviour) is defined by its operations [1] and the data that the operations are carried
out on [1];
An ADT is a complex data type;
Each ADTs has standardised methods/operations / a specific set of methods/operations
(such as addToEnd. Push etc.);
Implementation details are hidden from the user;
Users only need to know how to use the operations/methods;
Allow ADTs can be allocated memory dynamically;
dyanmic vs. static abstract data types?
static - fixed size (eg. array)
dynamic - can change size (eg. array list)
pros & cons of dynamic adt
pros:
- only uses space needed at any time
- makes efficient use of memory (in general)
cons:
- difficult to program
- can be slow to implement searches
- linked list only allows serial search
pros & cons of static adt
pros:
- easy to program
- easy to check overflow
- array allows random access
- deleting item does not affect index of other items
cons:
- can waste space
when to use stacks?
when to use queues?