With a sorted array we can search faster by doing a binary search

With a sorted array we can search faster by doing a binary search

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Nykoya Watson Advanced Data Structures With a sorted array we can search faster by doing a binary search. o Binary search finds the midpoint of the range o it searches the left half o if desired number is not found o then the right half is searched to see if number can be found o if it is you identify it if it is not then you specify. Types of sort: o Insertion sorts:- it operates in n-1 rounds o at the k^th round, you swap towards left side not stopping until seeing an item
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: with a smaller value o (it1) 89436-> 89436 o (it2)89436->48936 o (it3)48396->43896->34896 o (it4)24869->34689 Loop invariant; Selection sort: o Find the minimum o Bring to the front and swap with the first term etc. Divide and conquer: o Take a big problem into smaller problem What are the smarter solved. Recurrence relation:...
View Full Document

Ask a homework question - tutors are online