Skip to content

csu161/Search-and-Sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Search and Sort

Today we are going to help Rey find Luke.

Bubble Sort

Buble sort works by comparing two elements in an array and swapping them if they need to be swapped. This is repeated until all items in the array are in the correct order. We wil use this function to sort the array of Star Wars Character names. Text Explanation, Dancing Explanation, Cool Sounds

Binary Search

Binary Search works just like looking up a word in a dictionary or a number in a phonebook. If you are too young to have ever used each, this maybe hard for you. Binary Search assumes a sorted array (the one we just sorted in bubble sort), then check the middle of the array and sees if what we are looking for is greater than or less than the midpoint. Then it looks at that half of the array and so one until it is down to one item and hopefully that one matches the thing we are looking for. Video Explanation. This should return the index of Lukes location.

Merge Sort

Now for practice we are gonig to do a merge sort. I am not going to lie, this one is kind of tough. Basically, it breaks down the array until it has only two indexes sorts them back together. Now it has two, two length arrays. It merges those backtogether into one sorted array and so on until it has an original sorted array. Khan Academy Walk Through, Text Description and some psudo code, Dancing Explanation

Quick Sort

Khan Academy Walk Through. Videos: this video is very thourough, and this guy shows a way to implement it with moving pointers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages