**Q1 What are the advantages and disadvantages of B-star trees over Binary trees? (Asked by Motorola people)**

A1 B-star trees have better data structure and are faster in search than Binary trees, but it’s harder to write codes for B-start trees.

**Q2 Write the psuedo code for the Depth first Search.(Asked by Microsoft)**

A2

dfs(G, v) //OUTLINE

Mark v as "discovered"

For each vertex w such that edge vw is in G:

If w is undiscovered:

dfs(G, w); that is, explore vw, visit w, explore from there

as much as possible, and backtrack from w to v.

Otherwise:

"Check" vw without visiting w.

Mark v as "finished".

**Q3 Describe one simple rehashing policy.(Asked by Motorola people)**

A3 The simplest rehashing policy is linear probing. Suppose a key K hashes to location i. Suppose other key occupies H[i]. The following function is used to generate alternative locations:

rehash(j) = (j + 1) mod h

where j is the location most recently probed. Initially j = i, the hash code for K. Notice that this version of rehash does not depend on K.

**Q4 Describe Stacks and name a couple of places where stacks are useful. (Asked by Microsoft)**

A4 A Stack is a linear structure in which insertions and deletions are always made at one end, called the top. This updating policy is called last in, first out (LIFO). It is useful when we need to check some syntex errors, such as missing parentheses.

**Q5 Suppose a 3-bit sequence number is used in the selective-reject ARQ, what is the maximum number of frames that could be transmitted at a time? (Asked by Cisco)**

A5 If a 3-bit sequence number is used, then it could distinguish 8 different frames. Since the number of frames that could be transmitted at a time is no greater half the numner of frames that could be distinguished by the sequence number, so at most 4 frames can be transmitted at a time.

courtesy:http://www.crackthecampus.com

## No comments:

## Post a Comment