added bubble sort and refactored all of the examples into reusable functions