Searching and Sorting unit 1 Flashcards
(10 cards)
What are standard algorithms for searching data?
Linear search and binary search.
What are standard algorithms for sorting data?
Bubble sort and merge sort.
How does a linear search work?
It checks each item one by one until the target value is found or the end is reached.
How does a binary search work?
It repeatedly splits a sorted list in half to find the target value.
How does bubble sort work?
It repeatedly compares and swaps adjacent items until the list is sorted.
How does merge sort work?
It divides the list into smaller parts, sorts them, and merges them back together.
When is a simple algorithm like linear search acceptable?
When the data set is small and efficiency is not a concern.
Why is the choice of algorithm important?
Because different algorithms perform better or worse depending on the size and type of data.
What influences the choice of algorithm?
The data structure, the size of the data, and how the data needs to be processed.
How can you evaluate if an algorithm is suitable?
By using logical reasoning and test data to check if it meets the requirements efficiently.