About Data Structure

Standard
  • for binary search the values must be in sorted order.but linear search values need not to be sorted
  • Binary search requires an ordering comparison; linear search only requires equality comparisons
  • Binary search has complexity O(log n); linear search has complexity O(n)
  • Binary search requires random access to the data; linear search only requires sequential access
  • A linear search starts at the beginning of a list of values, and checks 1 by 1 in order for the result but A binary search starts in the middle of a sorted array

these are the difference between linear & binary search

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s