answersLogoWhite

0

"Searching technique" defines the way in which we look for a given value within a set of values. We define these techniques using algorithms.

Searching is always quicker when the data is in sorted order. We start in the middle of the set. If that's our value, we're done. Otherwise, we compare the middle value with the value we seek to determine which side of the set contains our value. We then discard the other half and repeat the process with the remaining half. If the remaining half is empty, the value does not exist.

This technique is known as a binary search and can be performed efficiently on any container that permits constant-time random-access, such as an array. Balanced binary trees can also be used. Lists do not support constant-time random-access so the benefit of binary search is often outweighed by added complexity of identifying the middle element of a range.

If the data is unsorted, we must use a linear search. Typically we start at the first element and work our way through to the last element, stopping when we find the value or reach the end of the sequence. Linear search can be performed on any container that allows forward traversal, including arrays and lists.

The return value of a search algorithm is typically an iterator; a pointer to the element or node that holds the value. If the value does not exist, we typically return an iterator to the one-past-the-end of the sequence. In the case of arrays we could return the zero-based index of the value, returning the count of elements when the value does not exist, however it is better to use iterators as this allows us to generalise our algorithms to cater for all container types.

User Avatar

Wiki User

8y ago

What else can I help you with?

Related Questions

What kind of searching technique is used in Google search?

Searching links to other websites that will tell you the answer(like WikiAnswers) or show a website that will relate what you are looking for.


Which advanced searching technique is correctly used in the search statement toddler AND Montessori school?

The advanced searching technique used in the search statement "toddler AND Montessori school" is Boolean operator "AND," which instructs the search engine to retrieve results that contain both keywords "toddler" and "Montessori school." This ensures that the search results are more specific and relevant to the user's query.


What do you mean by Sorting and Searching?

vikram


What advanced searching technique is correctly used in the search statement toddler AND Montessori school?

The advanced searching technique correctly used in the search statement "toddler AND Montessori school" is the Boolean operator "AND." This operator ensures that search results include both the term "toddler" and the term "Montessori school" in the documents retrieved.


What does sagashite mean?

Sagashite means searching ..


How many search techniqe's in data structure?

There are two types of searching technique used in data structure.such as linear and binary search.


What does the technique transfer mean?

Short for PFF


What does the word combing mean in math?

Searching, probably.


What does homeworking mean?

A mnemonic is a technique to remember information.


Is descriptive data a technique?

No, descriptive data is not a technique; it is data that describe the sample such as mean, SD, mode, and range.


Does any color mean seeking searching looking for?

gookhane


What does legally eradicate mean?

Possibly you are searching for the verb: expunge?