Professional Documents
Culture Documents
Data Structures 1
Data Structures 1
A class is made abstract by declaring one or more of its virtual functions to be pure. A
pure virtual function is one with an initializer of = 0 in its declaration
A. Struct Time
{
int m;
int h;
int s;
};
A. As a resource manager
As a virtual machine
Q. In the derived class, which data member of the base class are visible?
Q. What are the advantages and disadvantages of B-star trees over Binary trees? (Asked
by Motorola people)
A. 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.
Q. Write the psuedo code for the Depth first Search. (Asked by Microsoft)
A. 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:
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.
Q. Describe Stacks and name a couple of places where stacks are useful. (Asked by
Microsoft)
A. 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 syntax errors, such as missing parentheses.
Q. 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)
A. 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 number of
frames that could be distinguished by the sequence number, so at most 4 frames can be
transmitted at a time.