Академический Документы
Профессиональный Документы
Культура Документы
2) What do you mean by searching? Define searching problem and how do you
evaluate the performance of any searching algorithm?
In computers information retrieval is one of the most important applications. It usually
involves giving a piece of information called the key, and ask to find a record that
contains other associated information. This is achieved by first going through the list to
find if the given key exists or not. This process is called Searching. Computer systems
are often used to store large amounts of data from which individual records must be
retrieved according to some search criterion. The process of searching an item in a data
structure can be quite straightforward or very complex. Searching can be done on
internal data structures or an external data structures.
Searching methods are designed to take advantage of the file organization and
optimize the search for a particular record or to establish its absence. The file
organization and searching method chosen can make a substantial difference to an
applications performance.
3) Compare and contrast DFS and BFS and DFS + ID approaches
Once we have identified a problem as a search problem, its important to choose the
right type pf search. The below information may be useful while taking the decision.
In a Nutshell
Search
DFS
Time
O(c^k)
Space
O(k)
When to use
Must search tree anyway, know the
level the answers are on, or you
arent looking for the shallowest
number
BFS
O(c^d)
O(c^d)
DFS+ID
O(c^d)
O(d)
5) Write note on
i) Threaded lists
Threaded lists:A modification of the implementation of a list structure which makes it resemble
a set of ring structures is to make the right hand pointer of the last element of a sublist
point back to the head of the sublist.
structure. That will now has what is commonly called a Threaded List. the major
advantage associated with a threaded list is that it can be traversed without the aid of a
stack. Normally when traversing a conventional list structure the return addresses are
stacked, whereas in the threaded list they have been incorporated in the data structure.
One disadvantage associated with the use of list and ring structures for
representing classifications is that they can only be entered at the top. An additional
index giving entry to the structure at eaxh of the data elements increases the update
speed considerably. Another modification of the simple list representation has bee
studied extensively by Stanfel and Patt. The individual elements (or cells) of the list
structure are modified to incorporate one extra field, so that instead of each element
looking like this.
P1 P2
P1
P2
where the P s are pointers and S is a symbol. Otherwise no essential change has been
made to the simple representation. This structure has become to known as Doubly
chained Tree. Its properties have mainly been investigated for storing variable length
keys, where each key is made up by selecting symbols from a finite (usually small)
alphabet. For Ex, (A,B,c) be the set of key symbols and R1, R2, R3, R4, R5 be five
records to be stored.
Let us assign keys made of the 3 symbols, to the record as follows:
AAA R1
AB R2
AC R3
BB R4
BC R5
Below is an example of a doubly chained tree containing the keys and giving access to
the records. The top most element contains no symbol, it merely functions as the start of
the structure. Given an arbitrary key its presence or absence is detected by matching it
against keys in the structure. Matching proceeds level by level, once a matching symbol
has been found at one level, the P1 pointer is followed to the set of alternative symbols
at the next level down. The matching will terminate either
a) when the key is exhausted, that is, no more key symbols are left to match; or
b) when no matching symbol is found at the current level
the key is present if the P1 pointer in the same cell as the last matching
symbol now points to a record;
ii.
P1 points to a further symbol, that is, the key fails short and is therefore
not in the structure.
For case b), we also have that the key is not in the structure, but now there is a
mismatch.
Stanfel and Patt have concentrated on generating search trees with minimum expected
search time, and preserving this property despite updating. For the detailed mathematics
demonstrating that this is possible the reader is referred to their cited work.
Dynamic Hashing
As the data base grows over time, we have three options:
-
Requires
Instead we create buckets on demand, and do not use all b bits of the
hash initially.
Note that the i appearing over the bucket address table tells how many
bits are required to determine the correct bucket.
All such entries will have a common hash prefix, but the length of this
prefix may be less than i.
Compute h(Ki).
If the bucket is full, we must split the bucket, and redistribute the
records.
Bucket address table only contains one pointer for each value of
current prefix length.
Disadvantages:-
Added complexity.
10