Algorithms and Data Structures
Algorithms and Data Structures
(CSC112)
Handout -1
Introduction to Algorithms and Data Structures
Linked Lists
public class Node
{
Stacks
Collection with access only to the last element inserted
Last in first out
insert/push
remove/pop
top
make empty
Queue
Trees
Similar to a linked list
public class TreeNode
{
Hash Tables
Take a key, apply function
f(key) = hash value
store data or object based on hash value
Sorting O(N), access O(1) if a perfect hash function and enough memory for table
how deal with collisions?
-----------------------------------------------