Binary Search Flashcards
What is algorithm ?
An algorithm is a set of instructions for accomplishing a task. Every piece of code could be called an algorithm
What is binary search algorithm
It is search algorithm where you divide the ordered set each time until you find the item
Ex: search 1 => 50 - 25 - 13 - 7 - 4 - 2 - 1
What is the big O - performance - of the binary search?
log 2 n
What is big O notition?
Run time of algorithms, It’s a notation that describe how fast the algorithm is
The formula => O(n) where n is number of steps
What the difference between array and linked list?
Array = > store item together in the memory, when new item added and there is no space next to the rest, the array will move to another slots where items can store togather
Array is random access
In search -> o(1)
In insert and delete -> o(n)
Linked list => store item in any free slot - not nessary togther - and each item will point to the next item.
List is sequential acess
In search -> o(n)
In insert and delete -> o(1)
What is selection sort algorithm?
It is a sorting algotithm where it is performance is O(n^2)