Data Structure Interview Questions – Set 05

What is doubly linked list?

The doubly linked list is a complex type of linked list in which a node contains a pointer to the previous as well as the next node in the sequence. In a doubly linked list, a node consists of three parts:

  • node data
  • pointer to the next node in sequence (next pointer)
  • pointer to the previous node (previous pointer).

Calculate the address of a random element present in a 2D array, given base address as BA.

Row-Major Order: If array is declared as a[m][n] where m is the number of rows while n is the number of columns, then address of an element a[i][j] of the array stored in row major order is calculated as,

Address(a[i][j]) = B. A. + (i * n + j) * size

Column-Major Order: If array is declared as a[m][n] where m is the number of rows while n is the number of columns, then address of an element a[i][j] of the array stored in column major order is calculated as

Address(a[i][j]) = ((j*m)+i)*Size + BA.

What is a dequeue?

Dequeue (also known as double-ended queue) can be defined as an ordered set of elements in which the insertion and deletion can be performed at both the ends, i.e. front and rear.

Write the postfix form of the expression: (A + B) * (C – D)

AB+CD-*

State the properties of B Tree.

A B tree of order m contains all the properties of an M way tree. In addition, it contains the following properties.

  • Every node in a B-Tree contains at most m children.
  • Every node in a B-Tree except the root node and the leaf node contain at least m/2 children.
  • The root nodes must have at least 2 nodes.
  • All leaf nodes must be at the same level.

What is the minimum number of queues that can be used to implement a priority queue?

Two queues are needed. One queue is used to store the data elements, and another is used for storing priorities.

List the area of applications of Data Structure.

Data structures are applied extensively in the following areas of computer science:

  • Compiler Design,
  • Operating System,
  • Database Management System,
  • Statistical analysis package,
  • Numerical Analysis,
  • Graphics,
  • Artificial Intelligence,
  • Simulation

Define Linked List Data structure.

Linked List is the collection of randomly stored data objects called nodes. In Linked List, each node is linked to its adjacent node through a pointer. A node contains two fields, i.e. Data Field and Link Field.

Which data structure suits the most in the tree construction?

Queue data structure

What are the operations that can be performed on a stack?

  • Push Operations
  • Pop Operations
  • Peek Operations