Data structures and Algorithm Concepts

21 November 2022


A data structure is a particular way of organizing data in a computer so that it can be used effectively.

What is the difference between a Stack and a Queue?

Stack: A stack is a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top. A stack follows the LIFO (Last In First Out) principle, i.e., the element inserted at the last is the first element to come out.

What is the difference between a Stack and a Queue?

Queue
: A queue is a linear data structure in which elements can be inserted only from one side of the list called rear, and the elements can be deleted only from the other side called the front. The queue data structure follows the FIFO (First In First Out) principle, i.e. the element inserted at first in the list, is the first element to be removed from the list.


What is a Doubly Linked List?

Ans: A Doubly Linked List (DLL) contains an extra pointer, typically called previous pointer, together with next pointer and data which are there in singly linked list.


What is the difference between a Clustered index and non-clustered index?

Ans: A clustered index is a special type of index that reorders the way records in the table are physically stored whereas a non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.


Which data structures are used for BFS and DFS of a graph?
 

Ans: 

Queue is used for BFS (Breadth first search)

Stack is used for DFS (Depth first search).

DFS can also be implemented using recursion.


 

Ask Us Anything !