Commonly Asked Data Structures Interview Questions.

interview questions on data structures with answers

What is a Data Structure? 
A data structure is a way of organizing the data so that the data can be used efficiently.

 Describe the types of Data Structures?

Data Structures are mainly classified into two types-

1)Linear data structures.

data is organized in sequential manner. For eg Stack, Queue, Array, Linked list etc.

2)Non-Linear data structures.

Data is organised in non-linear manner i.e not in sequence. For eg Tree, Graph.

What is a stack?

The stack is an ordered list in which, insertion and deletion can be performed only at one end that is called the top. Elements are inserted and deleted in the Last in First out manner i.e LIFO. Push and Pop are the operations of Stack.PUSH specifies that data is being inserted into the stack. POP specifies data retrieval.

What are the Applications Of stack?

Expression evaluation, Memory Management, Function calling and return, reversing strings, etc.

How is an Array different from Linked List? 

  1. Arrays size is fixed, Linked Lists are Dynamic in size.

2. Inserting and deleting a new element in an array of elements is expensive, Whereas both insertion and deletion can easily be done in Linked Lists.

3. Random access is not allowed in Linked Listed.

4. Arrays have better cache locality that can make a pretty big difference in performance.

What is a Queue?

Queue follows the order is First IFirst Out (FIFO) to access elements. Mainly the following are basic operations on queue: Enqueue, Dequeue.

What is a array?

Arrays, the collection of similar types of data items stored at contiguous memory locations. 

What is a Linked List?

 A linked list is a linear collection of nodes, that node contains two parts address and data.

Linked List has following Types,

1)Singly Linked List.

In singly Linked List node has two parts data and address which refers to the next node. The last Node address contains NULL that does not point to any other node.

2)Doubly Linked List.

In doubly Linked List node has three parts, data and two reference pointers in which the previous pointer points to the previous node and next pointer points to the next node. The last Node’s next pointer address contains NULL and the first node’s previous pointer contains NULL.

3)Circular Linked List.

In Singly circular linked list last node next pointer points to the first node. And in the doubly linked list, the last Node’s next pointer points to the first node, and the first node’s previous pointer points to the last node.

What is a Tree data structure?

A tree, a hierarchical data structure defined as a collection of nodes. Nodes represent value and nodes are connected by edges. A tree has the following properties:

  1. The tree has one node called root.
  2. Each node has one parent only but can have multiple children.
  3. Each node connected to its children via edge.

What is a Graph data structure?

A graph is a common data structure that consists of a finite set of nodes (or vertices) and a set of edges connecting them.

What are the types of Trees?

1)Binary Tree.

Tree which has at most two children to its parent is called as binary tree.

2)Binary Search Tree.

The left child value of a node should in BST be less than or equal to the parent value, and the right child value should always be greater than or equal to the parentโ€™s value.ย 

Interview Questions On Object oriented programming

SQL Interview questions

TCS NQT-2021 coding questions

Snake game using python

c interview questions

Leave a Comment