Algoritm
|
Avvalgi sarflaganlik
|
Qidiruv zaxiralari
|
Sarflanganlik
|
Linear search
|
0
|
1
|
O(n)
|
Binary search
|
log_2(n)
|
log_2(n)
|
O(log n)
|
1-jadval. Linear search va binary search algoritmi farqi
Ko'rib turganingizdek, binary search algoritmi linear searchdan ko'ra muhim darajada tezroq ishlaydi, ammo ularning qidiruv zaxiralari, yani xotirani necha marta tekshirish kerakligi, bir xil bo'ladi.
Adabiyotlar.
"Introduction to Algorithms" kitobi - Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein
"Algorithms, Part I" va "Algorithms, Part II" kurslari - Robert Sedgewick va Kevin Wayne
"The Algorithm Design Manual" kitobi - Steven S. Skiena
"Algorithms Unlocked" kitobi - Thomas H. Cormen
"Grokking Algorithms" kitobi - Aditya Bhargava
"Data Structures and Algorithms in Python" kitobi - Michael T. Goodrich, Roberto Tamassia va Michael H.
Do'stlaringiz bilan baham: |