Your Ad Here

Sunday, December 28, 2008

Recent Data Structure Interview Questions & Answers

Q : What’s the purpose of a left child node and a right child node?
A : The left child node and right child node helps in sorting technology because parent will be having larger value than that of left and left child will be having larger value than that of right.

Q : What is the advantage of using a queue linked list?
A : The Most Important is CPU Scheduling , refers a Queue for scheduling.
Queue is to Faster then Other One(stack)

Q : What is linked list?
A : Linked list is a data structure which is contain the data elements and a pointer of the node type of which points to the next node in the linked list. It is useful when you do not know in advance how many elements will be there so you cannot pre allocate space (e.g. using an array).

Q : Which data structure is used to perform the recursion?
A : Stack has the LIFO (Last In First Out) property; it remembers it is a ‘caller’. Therefore, it knows as to whom it should return when the function has to return. On the other hand, recursion makes use of the system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (non-recursive) function. Even when such the equivalent is iterative procedures are written explicit, stack is to be used.

Q : What are some of the applications for the tree data structure?
A : There are three types of the application for the tree data structure,
• Symbol table construction.
• Manipulation of the arithmetic expressions.
• Syntax analysis

Q : What is spanning Tree?
A : A spanning tree is a tree associated with a network. All the nodes are the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

Q : What’s the difference between STACK and ARRAY?
A : In array the items can be entered or removed in any order. Basically each member access is done using the index. No strict order is to be followed here to remove a particular element. STACK follows LIFO. Thus the item that is first entered would be the last removed.

Q : What is the method removes the value from the top of a stack?
A : The pop() member method removes the value from the top of a stack, which is then returned by the pop() member method to the statement that is called the pop() member method.

Q : What is queue ?
A : A Queue is a sequential organization of data. A queue is a FIFO type of data structure. An element is an inserted at the last position and an element is always taken out from the first position.

Q : Difference between malloc and calloc ?
A : calloc: allocate the m times n bytes initialized to 0
malloc: allocate the n bytes.

Q : what is an abstract data type?
A : Abstract data type is a logical cohesion of operands or variables along with a set of operation which can be performed on it. In Java we have most of data types as abstract data types. It helps in implementing the oops concept of encapsulation, abstraction, modularisation. Eg :String data type in java is an abstract data type. String is defined as a character array data member of a class All operations related to or which can be performed on strings are included as methods of the class.

Q : What’s the difference between bubble sort & quick sort?
A : Bubble sort is a very easy to program, slower, iterative. Compares neighboring numbers swaps it if required and continues this procedure until there are no more swaps
Quick Sort is a little difficult to program, Fastest, Recursive. Pivot number is selected, other numbers are compared with it and shifted to the right of number or left depending upon criteria again this method is applied to the left and right list generated to the pivot point number. Select pivot point among that the list.

Q : What is linear and non-linear data structures?
A : Linear data structure is an array, linked list
Non linear data structure is a tree, graph

Q : What is user-defined data type?

A : A user defined data type is a structure of which contains variables of basic data types.
For (ex) user can define a data type called employee which contains variables like string EmpName, int DeptNo, float Salary etc.

0 comments:

Your Ad Here