- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Comparison of Searching methods in Data Structures
In different cases, we perform different searching schemes to find some keys. In this section we will see what are the basic differences between two searching techniques, the sequential search and binary search.
Sequential Search | Binary Search |
---|---|
Time complexity is O(n) | Time complexity is O(log n) |
Finds the key present at first position in constant time | Finds the key present at center position in constant time |
Sequence of elements in the container does not affect. | The elements must be sorted in the container |
Arrays and linked lists can be used to implement this | It cannot be implemented directly into the linked list. We need to change the basic rules of the list to implement this |
Algorithm is iterative in nature | Algorithm technique is Divide and Conquer. |
Algorithm is easy to implement, and requires less amount of code. | Algorithm is slightly complex. It takes more amount of code to implement. |
N number of comparisons are required for worst case. | Log n number of comparisons are sufficient in worst case. |
- Related Articles
- Comparison of Sorting methods in Data Structures
- Java String Comparison Methods.
- Finger Searching in Data Structure
- Principles of Recursion in Data Structures
- Abstract Data Type in Data Structures
- Searching a Graph in Data Structure
- Comparison of Search Trees in Data Structure
- Kernel Data Structures
- Kinetic Data Structures
- Inbuilt Data Structures in C#
- Inbuilt Data Structures in Python
- Tail Recursion in Data Structures
- Bernoulli Distribution in Data Structures
- Binomial Distribution in Data Structures
- Geometric Distribution in Data Structures

Advertisements