Sort And Searching Question:
Download Questions PDF

Explain exception filter?

Sort And Searching Interview Question
Sort And Searching Interview Question

Answer:

We now use binary search to solve the existence problem: is a given key in a sorted database of keys? For example, when checking the spelling of a word, you need only know whether your word is in the dictionary and are not interested in the definition. In a computer search, we keep the information in an array, sorted in order of the key. The binary search code in BinarySearch.java differs from our other applications in two details. First, the file size N need not be a power of two. Second, it has to allow the possibility that the item sought is not in the array. The client program implements an exception filter: it reads a sorted list of strings from a file (which we refer to as the whitelist) and an arbitrary sequence of strings from standard input and prints those in the sequence that are not in the whitelist.

Download Sort And Searching Interview Questions And Answers PDF

Previous QuestionNext Question
How to search binary in a sorted array?What is Insertion sort?