1 / 4

Finding Mr. Nosey Using Binary Search in a Sorted List of Mr. Men Characters

Discover how to locate Mr. Nosey in a list of Mr. Men using the binary search algorithm. This efficient searching technique operates on sorted lists by repeatedly dividing the search interval in half. Starting with the middle item, we compare Mr. Nosey with others in the list and adjust our search range accordingly. Follow this step-by-step process: analyze characters, reduce the list, and ultimately find Mr. Nosey. This example highlights the power of binary search for quick item retrieval within an organized collection.

sidney
Download Presentation

Finding Mr. Nosey Using Binary Search in a Sorted List of Mr. Men Characters

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush 6. Mr Small 7. Mr Strong 8. Mr Tall 9. Mr Tickle 10. Mr Topsy-Turvy ? Mr Nosey? Binary search This algorithm is for finding an item in a sorted list or determining that it is not in the list. Is Mr Nosey in the list opposite? First find the middle of the list: (10+1)/2 = 5.5 so take 6th item Compare Mr Nosey and Mr Small, Nosey comes before Small so reduce the list to the first half.

  2. 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush 6. Mr Small 7. Mr Strong 8. Mr Tall 9. Mr Tickle 10. Mr Topsy-Turvy 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush ? Mr Nosey? Binary search Now find the middle (1+5)/2 = 3rd item Compare Mr Nosey and Mr Happy , Nosey comes after Happy so reduce the list to the second half.

  3. 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush 6. Mr Small 7. Mr Strong 8. Mr Tall 9. Mr Tickle 10. Mr Topsy-Turvy 4. Mr Nosey 5. Mr Rush 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush ? Mr Nosey? Binary search Find the middle (4+5)/2 = 4.5 so take item 5 Compare Mr Nosey and Mr Rush, Nosey comes before Rush so take first half of list

  4. 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush 6. Mr Small 7. Mr Strong 8. Mr Tall 9. Mr Tickle 10. Mr Topsy-Turvy 4. Mr Nosey 5. Mr Rush 4. Mr Nosey 1. Mr Greedy 2. Mr Grumpy 3. Mr Happy 4. Mr Nosey 5. Mr Rush ? Mr Nosey? Binary search Compare Mr Nosey and Mr Nosey, We have found him!

More Related