# Top 25+ Data Structure Interview Questions [ ANSWERED ]

Last updated on 04th Jul 2020, Blog, Interview Questions

These Data Structure Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of Data Structure . As per my experience good interviewers hardly plan to ask any particular question during your interview, normally questions start with some basic concept of the subject and later they continue based on further discussion and what you answer.we are going to cover top 100 Data Structure Interview questions along with their detailed answers. We will be covering Data Structure scenario based interview questions, Data Structure interview questions for freshers as well as Data Structure interview questions and answers for experienced.

**Q1 What do you understand by data structure?**

__Ans:__

Data structure can ideally be defined as a data management, organization as well as storage format through which you can access as well as modify the data.

It is not only a collection of the values of data but defines the relationship with each other as well.

**Q2. Tell us about the linked list?**

__Ans:__

A linked list can be defined as a chain of nodes wherein each node is connected to the next one.

**Q3. Where is data structure majorly used?**

__Ans:__

Simplistically speaking, data structures are involved in all areas when data is engaged. Some of the prominent areas where it is applied are artificial intelligence, database management, statistical analysis, etc.

**Q4. What do you mean by LIFO?**

__Ans:__

LIFO stands for Last In First Out. It means that the data which was stored last would be the first one to be extracted.

**Q5. Tell us something about binary trees?**

__Ans:__

A binary tree is a form of data structure. It has two nodes, namely the left node and the right node.

**Q6. What is a queue?**

__Ans:__

A queue is a form of data structure that induces a list of data. In this form of structure, the old elements are removed from one end while the new ones keep getting added to the other end.

**Q7. What do you know about stack?**

__Ans:__

In stack, the newest data element is accessed first. As the name suggests, all old elements are pushed downwards leaving the last added one on the top.

**Q8. What exactly do you mean by merge sort?**

__Ans:__

In merge sort, adjacent data elements are merged into one to form a bigger list. These lists are further merged into another big list and the process keeps happening until a single list is obtained.

**Q9. Give us one advantage of linked lists?**

__Ans:__

One inherent advantage of linked lists is that it is very easy to modify irrespective of the number of elements that are there in the list.

**Q10. What is the least number of nodes that a binary tree can have?**

__Ans:__

A binary tree can have zero nodes as the least number. Further, the number can be increased to 1 or 2 nodes.

**Q11.What are linear and non linear data Structures?**

__Ans:__

**Linear:**A data structure is said to be linear if its elements form a sequence or a linear list. Examples: Array. Linked List, Stacks and Queues**Non-Linear:**A data structure is said to be non-linear if traversal of nodes is nonlinear in nature. Example: Graph and Trees.

**Q12.What are the various operations that can be performed on different Data Structures?**

__Ans:__

- Insertion : Add a new data item in the given collection of data items.
- Deletion : Delete an existing data item from the given collection of data items.
- Traversal : Access each data item exactly once so that it can be processed.
- Searching : Find out the location of the data item if it exists in the given collection of data items.
- Sorting : Arranging the data items in some order i.e. in ascending or descending order in case of numerical data and in dictionary order in case of alphanumeric data.

**Q13.How is an Array different from Linked List?**

__Ans:__

- The size of the arrays is fixed, Linked Lists are Dynamic in size.
- 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.
- Random access is not allowed in Linked Listed.
- Extra memory space for a pointer is required with each element of the Linked list.
- Arrays have better cache locality that can make a pretty big difference in performance.

**Q14.What is Stack and where it can be used?**

__Ans:__

Stack is a linear data structure which orders LIFO(Last In First Out) or FILO(First In Last Out) for accessing elements. Basic operations of stack are : Push, Pop , Peek

**Q15. What are the Applications of Stack?**

__Ans:__

- Infix to Postfix Conversion using Stack
- Evaluation of Postfix Expression
- Reverse a String using Stack
- Implement two stacks in an array
- Check for balanced parentheses in an expression

**Q16.What is a Queue, how it is different from stack and how is it implemented?**

__Ans:__

Queue is a linear structure which follows the order is F**irst **I**n **F**irst **O**ut** (FIFO) to access elements. Mainly the following are basic operations on queue:

- Enqueue
- Dequeue
- Front
- Rear

The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added. Both Queues and Stacks can be implemented using Arrays and Linked Lists.

**Q17.What are Infix, prefix, Postfix notations?**

__Ans:__

- Infix notation:
**X**+**Y –**Operators are written in-between their operands. This is the usual way we write expressions. An expression such as

- A * ( B + C ) / D

- Postfix notation (also known as “Reverse Polish notation”):
**+**Operators are written after their operands. The infix expression given above is equivalent to

- A B C + * D/

- Prefix notation (also known as “Polish notation”):

- / * A + B C D

**Q18.What is a Linked List ?**

__Ans:__

A linked list is a linear data structure (like arrays) where each element is a separate object. Each element (that is node) of a list is composed of two items – the data and a reference to the next node.

**Q19. What are the types of linked lists?**

__Ans:__

- Singly Linked List :
- Doubly Linked List :
- Circular Linked List :

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

__Ans:__

- Queue is used for BFS
- Stack is used for DFS. DFS can also be implemented using recursion (Note that recursion also uses function call stack).

**Q21.Can doubly linked be implemented using a single pointer variable in every node?**

__Ans:__

Doubly linked list can be implemented using a single pointer. See XOR Linked List – A Memory Efficient Doubly Linked List

**Q22.How to implement a stack using a queue?**

__Ans:__

A stack can be implemented using two queues. Let stack be implemented be ‘s’ and queues used to implement be ‘q1’ and ‘q2’. Stack ‘s’ can be implemented in two ways:

- Method 1 (By making push operation costly)
- Method 2 (By making pop operation costly) See Implement Stack using Queues

**Q23. Describe the types of Data Structures?**

__Ans:__

Data Structures are mainly classified into two types:

**Linear Data Structure:**A data structure is called linear if all of its elements are arranged in the sequential order. In linear data structures, the elements are stored in a non-hierarchical way where each item has the successors and predecessors except the first and last element.**Non-Linear Data Structure:**The Non-linear data structure does not form a sequence i.e. each item or element is connected with two or more other items in a non-linear arrangement. The data elements are not arranged in the sequential structure.

**Q24. List the area of applications of Data Structure?**

__Ans:__

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

**Q25. What is the difference between file structure and storage structure?**

__Ans:__

The main difference between file structure and storage structure is based on the memory area that is being accessed.

**Storage structure:**It is the representation of the data structure in computer memory.**File structure:**It is the representation of the storage structure in the auxiliary memory.

**Q26. List the data structures which are used in RDBMS, Network Data Model, and Hierarchical Data Model?**

__Ans:__

- RDBMS uses Array data structure
- Network data model uses Graph
- Hierarchical data model uses Trees

**Q27. Which data structure is used to perform recursion?**

__Ans:__

Stack data structure is used in recursion due to its last in first out nature. Operating system maintains the stack in order to save the iteration variables at each function call

**Q28. List the area of applications where stack data structure can be used?**

__Ans:__

- Expression evaluation
- Backtracking
- Memory Management
- Function calling and return

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

__Ans:__

- Push Operations
- Pop Operations
- Peek Operations

**Q30. Write the stack overflow condition?**

__Ans:__

Overflow occurs when top = Maxsize -1

**Q31. What is the difference between PUSH and POP?**

__Ans:__

PUSH and POP operations specify how data is stored and retrieved in a stack.

- PUSH: PUSH specifies that data is being “inserted” into the stack.
- POP: POP specifies data retrieval. It means that data is being deleted from the stack.

**Q32. Write the steps involved in the insertion and deletion of an element in the stack?**

__Ans:__

**Push:**

- Increment the variable top so that it can refer to the next memory allocation
- Copy the item to the at the array index value equal to the top
- Repeat step 1 and 2 until stack overflows

**Pop:**

- Store the topmost element into the an another variable
- Decrement the value of the top
- Return the topmost element

**Q33. What is a postfix expression?**

__Ans:__

An expression in which operators follow the operands is known as postfix expression. The main benefit of this form is that there is no need to group sub-expressions in parentheses or to consider operator precedence.

The expression “a + b” will be represented as “ab+” in postfix notation.

**Q34. What are the criteria of algorithm analysis?**

__Ans:__

An algorithm are generally analyzed on two factors − time and space. That is, how much execution time and how much extra space required by the algorithm.

**Q35.What are various data-structures available?**

__Ans:__

Data structure availability may vary by programming languages. Commonly available data structures are list, arrays, stack, queues, graph, tree etc.

**Q36.What is an algorithm?**

__Ans:__

Algorithm is a step by step procedure, which defines a set of instructions to be executed in certain order to get the desired output.

**Q37.Why do we need to do algorithm analysis?**

__Ans:__

A problem can be solved in more than one way. So, many solution algorithms can be derived for a given problem. We analyze available algorithms to find and implement the best suitable algorithm.

**Q38.What is asymptotic analysis of an algorithm?**

__Ans:__

Asymptotic analysis of an algorithm, refers to defining the mathematical foundation/framing of its run-time performance. Using asymptotic analysis, we can very well conclude the best case, average case and worst case scenario of an algorithm.

**Q39.What are asymptotic notations?**

__Ans:__

Asymptotic analysis can provide three levels of mathematical binding of execution time of an algorithm −

- Best case is represented by Ω(n) notation.
- Worst case is represented by Ο(n) notation.
- Average case is represented by Θ(n) notation.

**Q40.What is linear data structure?**

__Ans:__

A linear data-structure has sequentially arranged data items. The next time can be located in the next memory address. It is stored and accessed in a sequential manner. Arrays and lists are examples of linear data structure.

**Q41.What are common operations that can be performed on a data-structure?**

__Ans:__

The following operations are commonly performed on any data-structure −

- Insertion − adding a data item
- Deletion − removing a data item
- Traversal − accessing and/or printing all data items
- Searching − finding a particular data item
- Sorting − arranging data items in a pre-defined sequence

**Q42.Briefly explain the approaches to develop algorithms?**

__Ans:__

There are three commonly used approaches to develop algorithms −

- Greedy Approach − finding solution by choosing next best option
- Divide and Conquer − diving the problem to a minimum possible sub-problem and solving them independently
- Dynamic Programming − diving the problem to a minimum possible sub-problem and solving them combinedly

**Q43.Give some examples of greedy algorithms?**

__Ans:__

The below given problems find their solution using greedy algorithm approach −

- Travelling Salesman Problem
- Prim’s Minimal Spanning Tree Algorithm
- Kruskal’s Minimum Spanning Tree Algorithm
- Dijkstra’s Minimum Spanning Tree Algorithm
- Graph – Map Coloring
- Graph – Vertex Cover
- Knapsack Problem
- Job Scheduling Problem

**Q44.What are some examples of divide and conquer algorithms?**

__Ans:__

The below given problems find their solution using divide and conquer algorithm approach −

- Merge Sort
- Quick Sort
- Binary Search
- Strassen’s Matrix Multiplication
- Closest pair (points)

**Q45.What are some examples of dynamic programming algorithms?**

__Ans:__

The below given problems find their solution using divide and conquer algorithm approach −

- Fibonacci number series
- Knapsack problem
- Tower of Hanoi
- All pair shortest path by Floyd-Warshall
- Shortest path by Dijkstra
- Project scheduling

**Q46.What is a linked-list?**

__Ans:__

A linked-list is a list of data-items c

**Q47.Which Data Structure Should be used for implementing LRU cache?**

__Ans:__

We use two data structures to implement an LRU Cache.

- Queue which is implemented using a doubly linked list. The maximum size of the queue will be equal to the total number of frames available (cache size).The most recently used pages will be near the rear end and least recently pages will be near the front end.
- A Hash with page number as key and address of the corresponding queue node as value. See How to implement LRU caching scheme? What data structures should be used?

**Q48.How to check if a given Binary Tree is BST or not?**

__Ans:__

If inorder traversal of a binary tree is sorted, then the binary tree is BST. The idea is to simply do inorder traversal and while traversing keep track of previous key value. If the current key value is greater, then continue, else return false. See A program to check if a binary tree is BST or not for more details.

**Q49**. **Which data structure is used for dictionaries and spell checkers?**

__Ans:__

Data Structure for Dictionary and Spell Checker?

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

__Ans:__

AB+CD-*

**Q51. Which notations are used in Evaluation of Arithmetic Expressions using prefix and postfix forms?**

__Ans:__

Polish and Reverse Polish notations.

**Q52.What is an array?**

__Ans:__

Arrays are defined as the collection of similar types of data items stored at contiguous memory locations. It is the simplest data structure in which each data element can be randomly accessed by using its index number.

**Q53. How to reference all the elements in a one-dimension array?**

__Ans:__

It can be done by using an indexed loop such that the counter runs from 0 to the array size minus one. In this manner, you can reference all the elements in sequence by using the loop counter as the array subscript.

**Q54. What is a multidimensional array?**

__Ans:__

The multidimensional array can be defined as the array of arrays in which the data is stored in tabular form consisting of rows and columns. 2D arrays are created to implement a relational database lookalike data structure. It provides ease of holding the bulk of data at once which can be passed to any number of functions wherever required.

**Q55. How are the elements of a 2D array stored in the memory?**

__Ans:__

There are two techniques by using which, the elements of a 2D array can be stored in the memory.

**Row-Major Order:**In row-major ordering, all the rows of the 2D array are stored into the memory contiguously. First, the 1st row of the array is stored into the memory completely, then the 2nd row of the array is stored into the memory completely and so on till the last row.**Column-Major Order:**In column-major ordering, all the columns of the 2D array are stored into the memory contiguously. first, the 1st column of the array is stored into the memory completely, then the 2nd row of the array is stored into the memory completely and so on till the last column of the array.

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

__Ans:__

**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.

**Q57. Are linked lists considered linear or non-linear data structures?**

__Ans:__

A linked list is considered both linear and non-linear data structure depending upon the situation.

- On the basis of data storage, it is considered as a non-linear data structure.
- On the basis of the access strategy, it is considered as a linear data-structure.

**Q58. What are the advantages of Linked List over an array?**

__Ans:__

- The size of a linked list can be incremented at runtime which is impossible in the case of the array.
- The List is not required to be contiguously present in the main memory, if the contiguous space is not available, the nodes can be stored anywhere in the memory connected through the links.
- The List is dynamically stored in the main memory and grows as per the program demand while the array is statically stored in the main memory, size of which must be declared at compile time.
- The number of elements in the linked list are limited to the available memory space while the number of elements in the array is limited to the size of an array.

**Q59. If you are using C language to implement the heterogeneous linked list, what pointer type should be used?**

__Ans:__

The heterogeneous linked list contains different data types, so it is not possible to use ordinary pointers for this. For this purpose, you have to use a generic pointer type like void pointer because the void pointer is capable of storing a pointer to any type.

**Q60. What is a doubly linked list?**

__Ans:__

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).

**Q61.How quick sort works?**

__Ans:__

Quick sort uses divide and conquer approach. It divides the list in smaller ‘partitions’ using ‘pivot’. The values which are smaller than the pivot are arranged in the left partition and greater values are arranged in the right partition. Each partition is recursively sorted using quick sort.

**Q62.What is a graph?**

__Ans:__

A graph is a pictorial representation of a set of objects where some pairs of objects are connected by links. The interconnected objects are represented by points termed as vertices, and the links that connect the vertices are called edges.

**Q63.How depth first traversal works?**

__Ans:__

Depth First Search algorithm(DFS) traverses a graph in a depthward motion and uses a stack to remember to get the next vertex to start a search when a dead end occurs in any iteration.

**Q64.How breadth first traversal works?**

__Ans:__

Breadth First Search algorithm(BFS) traverses a graph in a breadthwards motion and uses a queue to remember to get the next vertex to start a search when a dead end occurs in any iteration.

**Q65.What is a tree?**

__Ans:__

A tree is a minimally connected graph having no loops and circuits.

**Q66.What is a binary tree?**

__Ans:__

A binary tree has a special condition that each node can have two children at maximum.

**Q67.What is a binary search tree?**

__Ans:__

A binary search tree is a binary tree with a special provision where a node’s left child must have value less than its parent’s value and node’s right child must have value greater than its parent value.

**Q68.What is tree traversal?**

__Ans:__

Tree traversal is a process to visit all the nodes of a tree. Because, all nodes are connected via edges (links) we always start from the root (head) node. There are three ways which we use to traverse a tree −

- In-order Traversal
- Pre-order Traversal
- Post-order Traversal

See the below image of a binary search tree, and traverse it using all available methods −

- In-order traversal − 10 14 19 27 31 35 42
- Pre-order traversal − 27 14 10 19 35 31 42
- Post-order traversal − 10 19 14 31 42 35 27

**Q69.What is an AVL Tree?**

__Ans:__

AVL trees are height balancing binary search trees. AVL tree checks the height of left and right subtrees and assures that the difference is not more than 1. This difference is called Balance Factor.

- BalanceFactor = height(left-subtree) − height(right-subtree)

**Q70.What is a spanning tree?**

__Ans:__

A spanning tree is a subset of Graph G, which has all the vertices covered with minimum possible number of edges. A spanning tree does not have cycles and it can not be disconnected.

**Data Structure Sample Resumes! Download & Edit, Get Noticed by Top Employers!**Download

**Q71.How many spanning trees can a graph have?**

__Ans:__

It depends on how connected the graph is. A complete undirected graph can have a maximum nn-1 number of spanning trees, where n is the number of nodes.

**Q72.How Kruskal’s algorithm works?**

__Ans:__

This algorithm treats the graph as a forest and every node it as an individual tree. A tree connects to another only and only if it has least cost among all available options and does not violate MST properties.

**Q73.How Prim’s algorithm finds a spanning tree?**

__Ans:__

Prim’s algorithm treats the nodes as a single tree and keeps on adding new nodes to the spanning tree from the given graph.

**Q74.What is a minimum spanning tree (MST)?**

__Ans:__

In a weighted graph, a minimum spanning tree is a spanning tree that has minimum weight that all other spanning trees of the same graph.

**Q75.What is a heap in data structure?**

__Ans:__

Heap is a special balanced binary tree data structure where the root-node key is compared with its children and arranged accordingly. A min-heap, a parent node has key value less than its childs and a max-heap parent node has value greater than its childs.

**Q76.What is a recursive function?**

__Ans:__

A recursive function is one which calls itself, directly or calls a function that in turn calls it. Every recursive function follows the recursive properties − base criteria where functions stops calling itself and progressive approach where the functions tries to meet the base criteria in each iteration.

**Q77.What is the tower of hanoi?**

__Ans:__

Tower of Hanoi, is a mathematical puzzle which consists of three towers (pegs) and more than one ring. All rings are of different size and stacked upon each other where the large disk is always below the small disk. The aim is to move the tower of disk from one peg to another, without breaking its properties.

**Q78. Define the queue data structure?**

__Ans:__

A queue can be defined as an ordered list which enables insert operations to be performed at one end called REAR and delete operations to be performed at another end called FRONT.

**Q79. List some applications of queue data structure?**

__Ans:__

The Applications of the queue is given as follows:

- Queues are widely used as waiting lists for a single shared resource like a printer, disk, CPU.
- Queues are used in the asynchronous transfer of data (where data is not being transferred at the same rate between two processes) for eg. pipes, file IO, sockets.
- Queues are used as buffers in most of the applications like MP3 media player, CD player, etc.
- Queues are used to maintain the playlist in media players to add and remove the songs from the play-list.
- Queues are used in operating systems for handling interrupts.

**Q80. What are the drawbacks of array implementation of Queue?**

__Ans:__

**Memory Wastage:**The space of the array, which is used to store queue elements, can never be reused to store the elements of that queue because the elements can only be inserted at front end and the value of front might be so high so that, all the space before that, can never be filled.-
**Array Size:**There might be situations in which we may need to extend the queue to insert more elements if we use an array to implement a queue, It will almost be impossible to extend the array size, therefore deciding the correct array size is always a problem in array implementation of a queue.

**Q81. How do you reference all the elements in a one-dimension array?**

__Ans:__

To reference all the elements in a one -dimension array, you need to use an indexed loop, So that the counter runs from 0 to the array size minus one. In this manner, You can reference all the elements in sequence by using the loop counter as the array subscript.

**Q82. In what areas do data structures are applied?**

__Ans:__

Data structures are essential in almost every aspect where data is involved. In general, algorithms that involve efficient data structure are applied in the following areas: numerical analysis, operating system, A.I., compiler design, database management, graphics, and statistical analysis, to name a few.

**Q83. What is LIFO?**

__Ans:__

LIFO is a short form of Last In First Out. It refers to how data is accessed, stored and retrieved. Using this scheme, data that was stored last should be the one to be extracted first. This also means that in order to gain access to the first data, all the other data that was stored before this first data must first be retrieved and extracted.

**Q84. What are binary trees?**

__Ans:__

A binary tree is one type of data structure that has two nodes, a left node, and a right node. In programming, binary trees are an extension of the linked list structures.

**Q85. Which data structures are applied when dealing with a recursive function?**

__Ans:__

Recursion, is a function that calls itself based on a terminating condition, makes use of the stack. Using LIFO, a call to a recursive function saves the return address so that it knows how to return to the calling function after the call terminates.

**Q86. What are multidimensional arrays?**

__Ans:__

Multidimensional arrays make use of multiple indexes to store data. It is useful when storing data that cannot be represented using single dimensional indexing, such as data representation in a board game, tables with data stored in more than one column.

**Q87. How linked lists are considered as linear or non-linear data structures?**

__Ans:__

It depends on where you intend to apply linked lists. If you based it on storage, a linked list is considered non-linear. On the other hand, if you based it on access strategies, then a linked list is considered linear.

**Q88. How does dynamic memory allocation help in managing data?**

__Ans:__

Apart from being able to store simple structured data types, dynamic memory allocation can combine separately allocated structured blocks to form composite structures that expand and contract as needed.

**Q89. What is FIFO?**

__Ans:__

FIFO stands for First-in, First-out, and is used to represent how data is accessed in a queue. Data has been inserted into the queue list the longest is the one that is removed first.

**Q90. What is merge sort?**

__Ans:__

Merge sort, is a divide-and-conquer approach for sorting the data. In a sequence of data, adjacent ones are merged and sorted to create bigger sorted lists. These sorted lists are then merged again to form an even bigger sorted list, which continues until you have one single sorted list.

**Q91. Differentiate NULL and VOID?**

__Ans:__

Null is a value, whereas Void is a data type identifier. A variable that is given a Null value indicates an empty value. The void is used to identify pointers as having no initial size.

**Q92. What is the primary advantage of a linked list?**

__Ans:__

A linked list is an ideal data structure because it can be modified easily. This means that editing a linked list works regardless of how many elements are in the list.

**Q93. How does variable declaration affect memory allocation?**

__Ans:__

The amount of memory to be allocated or reserved would depend on the data type of the variable being declared. For example, if a variable is declared to be of integer type, then 32 bits of memory storage will be reserved for that variable.

**Q94. What is the advantage of the heap over a stack?**

__Ans:__

The heap is more flexible than the stack. That’s because memory space for the heap can be dynamically allocated and de-allocated as needed. However, the memory of the heap can at times be slower when compared to that stack.

**Q95. What is Data abstraction?**

__Ans:__

Data abstraction is a powerful tool for breaking down complex data problems into manageable chunks. This is applied by initially specifying the data objects involved and the operations to be performed on these data objects without being overly concerned with how the data objects will be represented and stored in memory.

**Q96. How does a selection sort work for an array?**

__Ans:__

The selection sort is a fairly intuitive sorting algorithm, though not necessarily efficient. In this process, the smallest element is first located and switched with the element at subscript zero, thereby placing the smallest element in the first position.

**Q97 What is a dequeue?**

__Ans:__

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.

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

__Ans:__

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

**Q99. What is a fibonacci series?**

__Ans:__

Fibonacci Series generates subsequent numbers by adding two previous numbers. For example − 0 1 1 2 3 5 8 13.