Data Structure Interview Questions & Answers
Data Structure Interview Questions And Answers are as follows –
- What is a Data Structure?
A data structure is a way of organizing the data so that the data can be used efficiently. Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, B-trees are particularly well-suited for the implementation of databases, while compiler implementations usually use hash tables to look up identifiers.
- What are linear and non linear data Structures?
- 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.
- What are the various operations that can be performed on different Data Structures?
- 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
- How is an Array different from Linked List?
- 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.
- What is Stack and where it can be used?
Stack is a linear data structure in which the order LIFO(Last In First Out) or FILO(First In Last Out) for accessing elements. Basic operations of stack are : Push, Pop, Peek
- What is a Queue, how it is different from stack and how is it implemented?
The queue is a linear structure that follows the order is First In First Out (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.
- What are Infix, prefix, Postfix notations?
- 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”): X Y + 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”): + X YOperators are written before their operands. The expressions given above are equivalent to
/ * A + B C D
- What is a Linked List and What are its types?
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 comprising of two items – the data and a reference to the next node.Types of Linked List :
Singly Linked List : In this type of linked list, every node stores address or reference of next node in list and the last node has next address or reference as NULL. For example 1->2->3->4->NULL
Doubly Linked List : Here,here are two references associated with each node, One of the reference points to the next node and one to the previous node. Eg. NULL<-1<->2<->3->NULL
Circular Linked List : Circular linked list is a linked list where all nodes are connected to form a circle. There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly circular linked list. Eg. 1->2->3->1 [The next pointer of last node is pointing to the first]
- Which data structures are used for BFS and DFS of a graph?
- 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).
- Which Data Structure Should be used for implementing LRU cache?
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 rear end and least recently pages will be near front end.
- A Hash with page number as key and address of the corresponding queue node as value.
- How to check if a given Binary Tree is BST or not?
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 current key value is greater, then continue, else return false.
- 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,
- Artificial Intelligence,
- What is the difference between file structure and storage structure?
Difference between file structure and storage structure:
The main difference between file structure and storage structure is based on memory area that is being accessed.
Storage structure: It is the representation of the data structure in the computer memory.
File structure: It is the representation of the storage structure in the auxiliary memory.
- List the data structures which are used in RDBMS, Network Data Modal, and Hierarchical Data Model.
- RDBMS uses Array data structure
- Network data model uses Graph
- Hierarchal data model uses Trees
- Which data structure is used to perform recursion?
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
- What is a Stack?
Stack is an ordered list in which, insertion and deletion can be performed only at one end that is called the top. It is a recursive data structure having pointer to its top element. The stack is sometimes called as Last-In-First-Out (LIFO) list i.e. the element which is inserted first in the stack will be deleted last from the stack.
- List the area of applications where stack data structure can be used?
- Expression evaluation
- Memory Management
- Function calling and return
- What are the operations that can be performed on a stack?
- What is the difference between PUSH and POP?
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.
- Write the steps involved in the insertion and deletion of an element in the stack.
- 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
- Store the topmost element into the another variable
- Decrement the value of the top
- Return the topmost element
- What is a postfix expression?
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.
- 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.
- What are the advantages of Linked List over an array?
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.
- 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).
- Define the queue data structure.
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.
- List some applications of queue data structure.
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.
- What are the drawbacks of array implementation of Queue?
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 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 queue.
- 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.
- Define the tree data structure.
The Tree is a recursive data structure containing the set of one or more data nodes where one node is designated as the root of the tree while the remaining nodes are called as the children of the root. The nodes other than the root node are partitioned into the nonempty sets where each one of them is to be called sub-tree.
- List the types of tree.
There are six types of tree given as follows.
- General Tree
- Binary Tree
- Binary Search Tree
- Expression Tree
- Tournament Tree
- What are Binary trees?
A binary Tree is a special type of generic tree in which, each node can have at most two children. Binary tree is generally partitioned into three disjoint subsets, i.e. the root of the node, left sub-tree and Right binary sub-tree.
- State the properties of B Tree (Binary 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.
- List some applications of Tree-data structure?
Applications of Tree- data structure:
- The manipulation of Arithmetic expression,
- Symbol Table construction,
- Syntax analysis
- Hierarchal data model
- Define the graph data structure?
A graph G can be defined as an ordered set G(V, E) where V(G) represents the set of vertices and E(G) represents the set of edges which are used to connect these vertices. A graph can be seen as a cyclic tree, where the vertices (Nodes) maintain any complex relationship among them instead of having parent-child relations.
- What are the applications of Graph data structure?
The graph has the following applications:
- Graphs are used in circuit networks where points of connection are drawn as vertices and component wires become the edges of the graph.
- Graphs are used in transport networks where stations are drawn as vertices and routes become the edges of the graph.
- Graphs are used in maps that draw cities/states/regions as vertices and adjacency relations as edges.
- Graphs are used in program flow analysis where procedures or modules are treated as vertices and calls to these procedures are drawn as edges of the graph.
- What are the advantages of Binary search over linear search?
There are relatively less number of comparisons in binary search than that in linear search. In average case, linear search takes O(n) time to search a list of n elements while Binary search takes O(log n) time to search a list of n elements.
- What are the advantages of Selecetion Sort?
- It is simple and easy to implement.
- It can be used for small data sets.
- It is 60 per cent more efficient than bubble sort.
- What is the difference between NULL and VOID?
Null is actually a value, whereas Void is a data type identifier.
A null variable simply indicates an empty value, whereas void is used to identify pointers as having no initial size.
- What is algorithm?
Algorithm is a step by step procedure, which defines a set of instructions to be executed in certain order to get the desired output.
- What are some examples of divide and conquer algorithms?
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)
- What operations can be performed on Queues?
The below operations can be performed on a stack −
enqueue() − adds an item to rear of the queue
dequeue() − removes the item from front of the queue
peek() − gives value of front item without removing it
isempty() − checks if stack is empty
isfull() − checks if stack is full
- What is linear searching?
Linear search tries to find an item in a sequentially arranged data type. These sequentially arranged data items known as array or list, are accessible in incrementing memory location. Linear search compares expected data item with each of data items in list or array. The average case time complexity of linear search is Ο(n) and worst-case complexity is Ο(n2). Data in target arrays/lists need not to be sorted.
- What is binary search?
A binary search works only on sorted lists or arrays. This search selects the middle which splits the entire list into two parts. First the middle is compared.
This search first compares the target value to the mid of the list. If it is not found, then it takes decision on whether.
- What is bubble sort and how bubble sort works?
Bubble sort is comparison-based algorithm in which each pair of adjacent elements is compared and elements are swapped if they are not in order. Because the time complexity is Ο(n2), it is not suitable for large set of data.
- Tell me something about ‘insertion sort’?
Insertion sort divides the list into two sub-list, sorted and unsorted. It takes one element at time and finds it appropriate location in sorted sub-list and insert there. The output after insertion is a sorted sub-list. It iteratively works on all the elements of unsorted sub-list and inserts them to sorted sub-list in order.
- What is selection sort?
Selection sort is in-place sorting technique. It divides the data set into two sub-lists: sorted and unsorted. Then it selects the minimum element from unsorted sub-list and places it into the sorted list. This iterates unless all the elements from unsorted sub-list are consumed into sorted sub-list.
- What is merge sort and how it works?
Merge sort is sorting algorithm based on divide and conquer programming approach. It keeps on dividing the list into smaller sub-list until all sub-list has only 1 element. And then it merges them in a sorted way until all sub-lists are consumed. It has run-time complexity of Ο(n log n) and it needs Ο(n) auxiliary space.
- What is shell sort?
Shell sort can be said a variant of insertion sort. Shell sort divides the list into smaller sublist based on some gap variable and then each sub-list is sorted using insertion sort. In best cases, it can perform upto Ο(n log n).
- How depth first traversal works?
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.
- How breadth first traversal works?
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.
- What is a binary search tree?
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 it’s parent value.
- What is tree traversal?
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
- What is an AVL Tree?
AVL trees are height balancing binary search tree. AVL tree checks the height of left and right sub-trees and assures that the difference is not more than 1. This difference is called Balance Factor.
BalanceFactor = height(left-sutree) − height(right-sutree)
- What is a spanning tree?
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 cannot be disconnected.
- How Kruskal’s algorithm works?
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.
- How Prim’s algorithm finds spanning tree?
Prim’s algorithm treats the nodes as a single tree and keeps on adding new nodes to the spanning tree from the given graph.
- What is a minimum spanning tree (MST)?
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.
- What is a heap in data structure?
Heap is a special balanced binary tree data structure where root-node key is compared with its children and arranged accordingly. A min-heap, a parent node has key value less than its child’s and a max-heap parent node has value greater than its child’s.
- What is a recursive function?
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.
- What is tower of hanoi?
Tower of Hanoi, is a mathematical puzzle which consists of three tower (pegs) and more than one rings. 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.
- What is hashing?
Hashing is a technique to convert a range of key values into a range of indexes of an array. By using hash tables, we can create an associative data storage where data index can be found by providing its key values.
- What is interpolation search technique?
Interpolation search is an improved variant of binary search. This search algorithm works on the probing position of required value.
- What is LIFO?
LIFO is a short form of Last In First Out. It refers 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.
- What is FIFO?
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.
- What is an ordered list?
An ordered list is a list in which each node’s position in the list is determined by the value of its key component, so that the key values form an increasing sequence, as the list is traversed.
- Differentiate NULL and VOID
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.
- What is the advantage of the heap over a stack?
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.
- What is a postfix expression?
A postfix expression is an expression in which each operator follows its operands. The advantage of this form is that there is no need to group sub-expressions in parentheses or to consider operator precedence.
- How do signed and unsigned numbers affect memory?
In the case of signed numbers, the first bit is used to indicate whether positive or negative, which leaves you with one bit short. With unsigned numbers, you have all bits available for that number. The effect is best seen in the number range (an unsigned 8-bit number has a range 0-255, while the 8-bit signed number has a range -128 to +127.
- What is the minimum number of nodes that a binary tree can have?
A binary tree can have a minimum of zero nodes, which occurs when the nodes have NULL values. Furthermore, a binary tree can also have 1 or 2 nodes.
- What are dynamic data structures?
Dynamic data structures are structures that expand and contract as a program runs. It provides a flexible means of manipulating data because it can adjust according to the size of the data.
- Which sorting algorithm is considered the fastest?
There are many types of sorting algorithms: quick sort, bubble sort, balloon sort, radix sort, merge sort, etc. Not one can be considered the fastest because each algorithm is designed for a particular data structure and data set. It would depend on the data set that you would want to sort.
- Differentiate STACK from ARRAY.
Stack follows a LIFO pattern. It means that data access follows a sequence wherein the last data to be stored when the first one to be extracted. Arrays, on the other hand, does not follow a particular order and instead can be accessed by referring to the indexed element within the array.
- Give a basic algorithm for searching a binary search tree.if the tree is empty, then the target is not in the tree, end search if the tree is not empty, the target is in the tree check if the target is in the root item if a target is not in the root item, check if a target is smaller than the root’s value if a target is smaller than the root’s value, search the left subtree else, search the right subtree
- What are the parts of a linked list?
A linked list typically has two parts: the head and the tail. Between the head and tail lie the actual nodes. All these nodes are linked sequentially.
- What is Huffman’s algorithm?
Huffman’s algorithm is used for creating extended binary trees that have minimum weighted path lengths from the given weights. It makes use of a table that contains the frequency of occurrence for each data element.
- What is Fibonacci search?
Fibonacci search is a search algorithm that applies to a sorted array. It makes use of a divide-and-conquer approach that can significantly reduce the time needed in order to reach the target element.
- Briefly explain recursive algorithm.
Recursive algorithm targets a problem by dividing it into smaller, manageable sub-problems. The output of one recursion after processing one sub-problem becomes the input to the next recursive process.
- Please explain what do you understand by 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, recently stored data is the one to be extracted first.
FIFO is a contraction for First In First Out. Following this approach, the data that is stored the least recently will be extracted first.
- Explain how does an Array differ from a Linked List?
Following are the various differences between an array and a linked list:
Additional Memory – For each element belonging to a linked list, extra memory space is required for storing the pointer. Arrays have no such requirement
Cache – In comparison to linked lists, arrays have better cache locality, which can significantly enhance the performance in various scenarios
Insertion and Deletion – It is easy to add or delete elements in a linked list. Inserting and deleting elements for an array is comparatively expensive
Random Access – Linked lists do not allow random access, while arrays do
Size – While the size of an array is fixed, the size of a linked list is dynamic
- What do you understand by Infix, Prefix, and Postfix notations?
Infix Notation – Operators are written between the operands. This is the standard way of writing expressions. For example, A * (B + C) / D
Postfix Notation/Reverse Polish Notation – Operators are written after the operands, hence the name. For instance, A B C + * D /
Prefix Notation/Polish Notation – Operators are written before the operands. / * A + B C D is the prefix notation equivalent of the aforementioned postfix notation example.
- Please explain the Linked List and its various types.
In a linked list, each element is a distinct object. Like arrays, linked lists are a linear type of data structures. In addition to data, every element of a linked list comprises a reference to the next element. Various types of linked lists are:
Singly Linked List – Each node stores the address or reference of the next node in the linked list, leave for the last node that stores NULL
Doubly Linked List – Each node keeps two references. One point to the next node and the other points to the previous node
Circular Linked List – In this type of linked list, all nodes are connected to form a circle. Hence, there is no NULL at the end. A circular linked list can either be a single circular linked list or a double circular linked list
- Which data structures are used for implementing LRU cache?
By organizing items in order of use, a Least Recently Used or LRU cache allows quick identification of an item that hasn’t been put to use for the longest time. Two data structures are used for implementing an LRU cache:
Queue – Implemented using a doubly linked list. The maximum size of the queue is determined by the total number of frames available i.e. the cache size. While the most recently used pages will be near the rear end of the queue, the least recently pages will be near the queue’s front end
Hashmap – Having page number as the key along with the address of the corresponding queue node as the value
- Could you give a brief explanation of the various approaches for developing algorithms?
There are 3 main approaches to developing algorithms:
Divide and Conquer – Involves dividing the entire problem into a number of subproblems and then solving each of them independently
Dynamic Programming – Identical to the divide and conquer approach with the exception that all sub-problems are solved together
Greedy Approach – Finds a solution by choosing the next best option
- Can you explain the Tower of Hanoi problem?
The Tower of Hanoi is a mathematical puzzle that comprises of three tower (or pegs) and more than one ring. Each ring is of varying size and stacked upon one another such that the larger one is beneath the smaller one.
The goal of the Tower of Hanoi problem is to move the tower of the disk from one peg to another without breaking the properties.
- Please explain an MST (Minimum Spanning Tree). Also, explain how does Prim’s algorithm find a minimum spanning tree.
An MST or Minimum Spanning Tree is a spanning tree in a weighted graph that has the minimum weight of all the possible spanning trees. Each node is treated as a single tree by Prim’s algorithm while adding new nodes to the spanning tree from the available graph.
- Where are Data Structures primarily used?
Data structures are very much needed in almost all of the fields that you can think of. Algorithms are the primary requirement in every data handling situation. Following are some of the scenarios where data structures are widely used:
- Numerical computation
- Operating system design
- Artificial Intelligence
- Compiler design
- Database handling
- Graphical processing
- Lexical analysis
- What Data Structures make use of pointers?
Pointers are used in a variety of data structures. They are majorly used in the following data structures:
- Binary trees
- Linked lists
- What is a priority queue?
A priority queue is an abstract data type that resembles a normal queue but has a priority assigned to elements. Elements with higher priority are processed before the elements with a lower priority. A minimum of two queues are required in this case, one for the data and the other to store the priority.
- Where are Tree Data Structures used?
Tree data structures are used in a variety of applications. Following are some of them:
- Arithmetic expression handling
- Symbol table creation
- Lexical analysis
- Hierarchical data modeling
- What are the disadvantages of implementing queues using arrays?
There are two main downsides when implementing queues using arrays. They are as follows:
Array sizing: The queue has to be constantly extended to make way for more elements that get implemented. Always extending the size of the array will not be feasible as there will be a discrepancy in the creation of the correct array size.
Memory dumps: The memory that is used to store the queue elements cannot be reused to actually store the queue. This is because of the working of queues where insertion happens at the head node only.
- Classify the Hashing Functions based on the various methods by which the key value is found.
- Direct method,
- Subtraction method,
- Modulo-Division method,
- Digit-Extraction method,
- Mid-Square method,
- Folding method,
- Pseudo-random method.
- What are the types of data structure?
The major types of data structure include the following:
- An array: This is the number of identical elements arranged in a certain order.
- A record: This contains some elements that are called fields.
- A tagged union: This contains some extra files that indicate the type of the data structure. It is also called disjoint union, variant record, variant, or discriminated union.
- A linked list: A linked list can simply be referred to as a list. Any type of data elements is linearly collected in a linked list. The data elements are called nodes and each node has a value pointing to the next node in the same linked list.
- A class: A data structure with data fields such as a record is known as a class.
- Stack: This works on the principle of first in, last out. This implies that the element that is stored in a stack last will be retrieved first, and vice versa.
- Queue: A queue works directly opposite a stack. It works on first in, first out. The element that is inserted first will be removed first.
- Linked list: Data are stored in a linked list linearly.
- Trees: Non-linear data storage is used.
- What factors determine the choice of data structure for a program?
If you are a programmer and want to choose a data structure for your program, consider these factors:
- The size of the data.
- The size of the storage.
- The data dynamics, such as changing or editing the data.
- The speed of data use
- What is the difference between a data type and data structure?
In computing, a data type is a group of data values with characteristics that are already defined. Some data types are floats, characters, integer, and string. These are called primitive data types. A data structure, on the other hand, is a grouping of data for easy organization and accessibility. Tables, Array stacks, structs, queues, classes, files, and lists are some data structure.
- Define leaf?
The node without any child node is a leaf node.
- What do you mean by overflow and underflow?
Overflow: When there is no more room to store new elements
Underflow: When there are no more elements to be deleted
- What if the time complexity of binary search?
- Can binary search be applied to linked list?
- When is a binary search algorithm best applied and when is linear search?
Binary Search – In case the data items are already sorted Linear Search.
- Python Interview Question And Answers
- HTML Interview Questions And Answers
- C# interview questions and answers
- DOTNET Interview Questions And Answers
- TOP 200+ JAVA Interview Questions And Answers
- [UPDATED] ASP.net Interview Questions And Answers
- C# Interview Questions And Answers
- C programming Interview Questions and Answers
- CPP Interview Questions And Answers
- JUNIT Interview Questions And Answers
- Networking Interview Questions And Answers
- Android Interview Questions And Answers
- Operating System Interview Questions and Answers
- Top 90 SQL Interview Questions And Answers
For more Interview Questions And Answers click here