Home/data structure interview questions/Page 2
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Write the C program to insert a node in circular singly list at the beginning.
#include<stdio.h> #include<stdlib.h> void beg_insert(int); struct node { int data; struct node *next; }; struct node *head; void main () { int choice,item; do { printf("\nEnter the item which you want to insert?\n"); scanf("%d",&item); beg_Read more
See lessDefine the queue data structure.
A queue can be defined as an ordered list that enables insert operations to be performed at one end called REAR and delete operations to be performed at another end called FRONT.
A queue can be defined as an ordered list that enables insert operations to be performed at one end called REAR and delete operations to be performed at another end called FRONT.
See lessList some applications of queue data structure.
Applications of the queue are given as follows: Queues are widely used as waiting lists for a single shared resource like a printer, disk, or 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,Read more
Applications of the queue are given as follows:
List the area of applications where stack data structure can be used?
Expression evaluation Backtracking Memory Management Function calling and return
What are FIFO and LIFO?
Both FIFO and LIFO are approaches to accessing, storing and retrieving elements from a data structure. LIFO stands for Last In First Out. In this approach, the most recently stored data is the one to be extracted first. FIFO stands for First In First Out. With this approach, the data that is storedRead more
Both FIFO and LIFO are approaches to accessing, storing and retrieving elements from a data structure. LIFO stands for Last In First Out. In this approach, the most recently stored data is the one to be extracted first.
FIFO stands for First In First Out. With this approach, the data that is stored earliest will be extracted first.
See lessHow do you reference all the elements in a one-dimension array?
We can reference all the elements in a one-dimension array using an indexed loop. The counter runs from 0 to the maximum array size, say n, minus one. All elements of the one-dimension array are referenced in sequence by using the loop counter as the array subscript.
We can reference all the elements in a one-dimension array using an indexed loop. The counter runs from 0 to the maximum array size, say n, minus one. All elements of the one-dimension array are referenced in sequence by using the loop counter as the array subscript.
See lessWhat is a binary search? When is it best used?
A binary search is an algorithm that starts with searching from the middle element. If the middle element is not the target element then it checks if it should search the lower half or the higher half. The process continues until the target element is found. The binary search works best when appliedRead more
A binary search is an algorithm that starts with searching from the middle element. If the middle element is not the target element then it checks if it should search the lower half or the higher half. The process continues until the target element is found.
The binary search works best when applied to a list with sorted or ordered elements.
See lessWhat is a queue? How is it different from a stack?
A queue is a form of linear structure that follows the FIFO (First In First Out) approach for accessing elements. Dequeue, enqueue, front, and rear are basic operations on a queue. Like a stack, a queue can be implemented using arrays and linked lists. In a stack, the item that is most recently addeRead more
A queue is a form of linear structure that follows the FIFO (First In First Out) approach for accessing elements. Dequeue, enqueue, front, and rear are basic operations on a queue. Like a stack, a queue can be implemented using arrays and linked lists.
In a stack, the item that is most recently added is removed first. Contrary to this, in the case of a queue, the item least recently added is removed first.
See lessWhat is a stack? State some applications.
A stack is a linear data structure that follows either the LIFO (Last In First Out) or FILO (First In Last Out) approach for accessing elements. Push, pop, and peek are the basic operations of a stack. Some applications of a stack are: Checking for balanced parentheses in an expression The evaluatioRead more
A stack is a linear data structure that follows either the LIFO (Last In First Out) or FILO (First In Last Out) approach for accessing elements. Push, pop, and peek are the basic operations of a stack.
Some applications of a stack are:
What is a multidimensional array?
If an array has more than two dimensions, it is called a multidimensional array. They are also called an array of arrays. For example, a 3-D array will look like this: int 3darr[10][20][30] – this array can store 10*20*30 elements. Assigning values int ndarr[2][3][5] = {{{1,2,4,5},{5,6,7,9}, {6,5,4,Read more
If an array has more than two dimensions, it is called a multidimensional array. They are also called an array of arrays. For example, a 3-D array will look like this:
– this array can store 10*20*30 elements.
Assigning values
int ndarr[2][3][5] = {{{1,2,4,5},{5,6,7,9}, {6,5,4,3}}, {{1,1,3,4}, {2,3,4,6}, {5,6,7,8}}};
Accessing elements
To access each element, we need three nested loops, say i,j,k, so that we can get the value as ndarr[i][j][k]
See less