Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Search Algorithms

vinayak edited this pageMay 3, 2020 ·3 revisions

Linear

alt text

FromWikipedia: linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched.The linear search runs in at the worst linear time and makes at most n comparisons, where n is the length of the list.

Properties

  • Worst case performanceO(n)
  • Best case performanceO(1)
  • Average case performanceO(n)
  • Worst case space complexityO(1) iterative

Binary

alt text

FromWikipedia: Binary search, also known as half-interval search or logarithmic search, is a search algorithm that finds the position of a target value within a sorted array. It compares the target value to the middle element of the array; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until it is successful.

Properties

  • Worst case performanceO(log n)
  • Best case performanceO(1)
  • Average case performanceO(log n)
  • Worst case space complexityO(1)

Jump

alt-text

FromWikipedia: Jump search or block search refers to a search algorithm for ordered lists. It works by first checking all items Lkm, where {\displaystyle k\in \mathbb {N} } k\in \mathbb {N} and m is the block size, until an item is found that is larger than the search key. To find the exact position of the search key in the list a linear search is performed on the sublist L[(k-1)m, km].

Properties

  • Worst case performance  O(n)
  • Best case performance O(√n)
  • Average case performance  O(√n)
  • Worst case space complexity O(1)
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp