[an error occurred while processing this directive]

Section 2 Notes

Lists

What are possible representations for lists?





How would you implement list operations for different representations of a list?

Operation Linked List Continuous
Append(L, e)






   
Remove(L, e)






   
GetPosition(L, e)





   
Find(L, e)







   

Trees

What are the different types of trees?






Tree terminology

Questions

1. Insert G, H, F, and O into the alphabetically sorted binary tree below:

2. Insert 30 into the numerically sorted binary tree below:


3. Delete P from the alphabetically sorted binary tree below:


4. Delete D from the alphabetically sorted binary tree below (show all possibilities):


5. Delete the root (show all possibilities that preserve a sorted binary tree):


Running Time

Operation Linked List Continuous List Sorted Binary Tree
Insert(L, index, x) for lists
Insert(T, x) for trees

     
Find(L, x)

     
Remove(L, x)

     


Draw all the binary trees that you can generate with this set of data (Hint: Try inserting in different orders):
1, 3, 5, 7








[an error occurred while processing this directive]