Design and Analysis of Algorithms Interview Questions



1.
What is data structure?

The logical and mathematical model of a particular organization of data is called data structure.
There are two types of data structure
  • Linear
  • Nonlinear


2.
What is a linked list?

A linked list is a linear collection of data elements, called nodes, where the linear order is given by pointers. Each node has two parts first part contain the information of the element second part contains the address of the next node in the list.

3.
What is a queue?

A queue is an ordered collection of items from which items may be deleted at one end (front end) and items inserted at the other end (rear end). It obeys FIFO rule there is no limit to the number of elements a queue contains.

4.
What is a spanning Tree?

A spanning tree is a tree associated with a network. All the nodes of 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.

5.
What is precision?

Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point.
6.
What are the goals of Data Structure?

It must rich enough in structure to reflect the actual relationship of data in real world. The structure should be simple enough for efficient processing of data.

7.
What is the difference between a Stack and an Array?

Stack
  • Stack is a dynamic object whose size is constantly changing as items are pushed and popped .
  • Stack may contain different data types.
  • Stack is declared as a structure containing an array to hold the element of the stack, and an integer to indicate the current stack top within the array.
  • Stack is a ordered collection of items.
Array
  • Array is an ordered collection of items.
  • Array is a static object.
  • It contains same data types.
  • Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.

8.
What is sequential search?

In sequential search each item in the array is compared with the item being searched until a match occurs. It is applicable to a table organized either as an array or as a linked list.

9.
What are the disadvantages array implementations of linked list?

The no of nodes needed can’t be predicted when the program is written.
The no of nodes declared must remain allocated throughout its execution.

10.
What is a priority queue?

The priority queue is a data structure in which the intrinsic ordering of the elements.
11.
What are the disadvantages of sequential storage?

Fixed amount of storage remains allocated to the data structure even if it contains less element.
No more than fixed amount of storage is allocated causing overflow.

12.
Define circular list?

In linear list the next field of the last node contain a null pointer, when a next field in the last node contain a pointer back to the first node it is called circular list.

13.
What does abstract Data Type Mean?

Data type is a collection of values and a set of operations on these values. Abstract data type refer to the mathematical concept that define the data type.

14.
What do you mean by recursive definition?

The definition which defines an object in terms of simpler cases of itself is called recursive definition.

15.
What actions are performed when a function is called?

When a function is called
  • arguments are passed
  • local variables are allocated and initialized
  • transferring control to the function
16.
Define double linked list?

It is a collection of data elements called nodes, where each node is divided into three parts
  • An info field that contains the information stored in the node.
  • Left field that contain pointer to node on left side.
  • Right field that contain pointer to node on right side.

17.
What do you mean by overflow and underflow?

When new data is to be inserted into the data structure but there is no available space i.e.free storage list is empty this situation is called overflow.
When we want to delete data from a data structure that is empty this situation is called underflow.

18.
Whether Linked List is linear or Non-linear data structure?

According to Access strategies Linked list is a linear one. According to Storage Linked List is a Non-linear one.

19.
What do you mean by free pool?

Pool is a list consisting of unused memory cells which has its own pointer.

20.
What are the methods available in storing sequential files ?

  • Straight merging
  • Natural merging
  • Polyphase sort
  • Distribution of Initial runs
21.
What is a node class?

A node class is a class that has added new services or functionality beyond the services inherited from its base class.

22.
what is binary tree?

A binary tree is a tree data structure in which each node has at most two child nodes, usually distinguished as left and right.