Showing posts with label Data Structures. Show all posts
Showing posts with label Data Structures. Show all posts

Friday, 18 November 2011

Classify the Hashing Functions based on the various methods by which the key value is found.


  • Direct method,

  • Subtraction method,

  • Modulo-Division method,

  • Digit-Extraction method,

  • Mid-Square method,

  • Folding method,

  • Pseudo-random method.

Sort the given values using Quick Sort :

Sorting takes place from the pivot value, which is the first value of the given elements, this is marked bold. The values at the left pointer and right pointer are indicated using L and R respectively.

Since pivot is not yet changed the same process is continued after

Sunday, 6 November 2011

Friday, 28 October 2011

A binary tree with 20 nodes has ____ null branches?

Ans: 21

Let us take a tree with 5 nodes (n=5)

It will have only 6 (ie,5+1) null branches. In general,

            A binary tree with n nodes has exactly n+1 null nodes.

Sorting is not possible by using which of the following methods?


  1. Insertion

  2. Selection

  3. Exchange

  4. Deletion


Ans: Deletion

Using insertion we can perform insertion sort, using selection we can perform selection sort, using exchange we can perform the bubble sort (and other similar sorting methods). But no sorting method can be done just using deletion.

What is the data structures used to perform recursion?

Stack. Because of its LIFO (Last In First Out) property it remembers its ‘caller’ so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls.

Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.