Bifalgorithm post · Computer science one · Searching
What is the general searching problem?
What is the general searching problem? (Computer science one · Searching) — "Searching is a very basic operation. Given a collection of data, we wish to find a…
Ideas in this flowchart
- Searching is the general problem of finding elements that match a criterion.
- A search operates on a collection of data and a particular key element.
- The basic output is an element aᵢ such that aᵢ equals the key eₖ.
- The equality criterion is not explicitly specified.
- The collection may be an array, list, set, or another data structure.
- The elements may be numbers, strings, objects, or other types.
- The abstract problem has several possible variations.
- For an ordered collection, the search may return the first or last matching element.
- The search may return all elements that match the criteria.
- Finding minimum, maximum, or median elements are also search variations.
- Designing a search solution requires additional considerations.
- The search may return an index instead of the matching element.
- An unsuccessful search may return null or a special flag value.
- An unsuccessful search may throw an exception.