YouTube Icon

Interview Questions.

Top 100+ Data Structures Interview Questions And Answers - May 29, 2020

fluid

Top 100+ Data Structures Interview Questions And Answers

Question 1. What Is Data Structure?

Answer :

A facts structure is a way of organizing statistics that considers not best the objects stored, but additionally their dating to each different. Advance information about the relationship between statistics gadgets lets in designing of green algorithms for the manipulation of data.

Question 2. What Are The Goals Of Data Structure?

Answer :

It need to wealthy sufficient in shape to reflect the actual courting of facts in real international. The shape ought to be simple enough for green processing of information.

RDBMS Interview Questions
Question 3. What Does Abstract Data Type Mean?

Answer :

Data kind is a group of values and a set of operations on these values. Abstract information kind talk over with the mathematical concept that define the facts kind.

It is a beneficial tool for specifying the logical houses of a statistics kind.

ADT consists of two components

1) Values definition
2) Operation definition

Example:-The value definition for the ADT RATIONAL states that RATIONAL price consists of  integers, 2d doesn’t identical to zero.

The operator definition for ADT RATIONAL consists of the operation of advent (make rational) addition, multiplication and test for equality.

Question 4. What Is The Difference Between A Stack And An Array?

Answer :

STACK:

i) Stack is a ordered collection of objects.
Ii) Stack is a dynamic object whose size is continuously changing as objects are pushed and popped.
Iii) Stack can also comprise exclusive statistics sorts.
Iv) Stack is asserted as a structure containing an array to maintain the element of the stack, and an integer to signify the current stack pinnacle within the array.

ARRAY:

i) Array is an ordered collection of items.
Ii) Array is a static item i.E. No of object is fixed and is assigned with the aid of the announcement of the array.
Iii) It includes identical statistics sorts.
Iv) Array may be domestic of a stack i.E. Array may be declared massive enough for maximum length of the stack.

Adv Java Tutorial
Question 5. What Do You Mean By Recursive Definition?

Answer :

The definition which defines an item in terms of less complicated cases of itself is referred to as recursive definition.

DBMS Interview Questions
Question 6. What Is Sequential Search?

Answer :

In sequential seek each object within the array is in comparison with the object being searched until a healthy happens. It is applicable to a desk prepared either as an array or as a connected list.

Question 7. What Actions Are Performed When A Function Is Called?

Answer :

When a function is called

i) arguments are handed.
Ii) local variables are allotted and initialized.
Ii) transferring manage to the function.

Core Java Tutorial Adv Java Interview Questions
Question 8. What Actions Are Performed When A Function Returns?

Answer :

i) Return deal with is retrieved.
Ii) Function’s information location is freed.
Iii) Branch is taken to the return deal with.

Question nine. What Is A Linked List?

Answer :

A connected list is a linear series of information factors, referred to as nodes, wherein the linear order is given through guidelines. Each node has  elements first component contain the records of the detail second part includes the address of the next node within the listing.

Core Java Interview Questions
Question 10. What Are The Advantages Of Linked List Over Array (static Data Structure)?

Answer :

The dangers of array are:

i) unlike linked list it's far high-priced to insert and delete elements inside the array.
Ii) One can’t double or triple the size of array because it occupies block of reminiscence area.

In connected listing

i) each element in list contains a discipline, called a link or pointer which includes the deal with of the subsequent element.
Ii) Successive detail’s want not occupy adjoining space in memory.

C Tutorial
Question 11. We Apply Binary Search Algorithm To A Sorted Linked List, Why?

Answer :

No we can not practice binary seek algorithm to a sorted connected list, when you consider that there's no way of indexing the center detail in the list. This is the downside in using connected list as a information shape.

C Interview Questions
Question 12. What Do You Mean By Free Pool?

Answer :

Pool is a listing such as unused memory cells which has its own pointer.

RDBMS Interview Questions
Question 13. What Do You Mean By Garbage Collection?

Answer :

It is a method wherein the running gadget periodically collects all the deleted space onto the loose storage list.

It takes place when there may be minimum quantity of area left in storage list or whilst CPU is good.

The trade technique to that is to without delay reinsert the distance into unfastened storage list that's time ingesting.

CSS Advanced Tutorial
Question 14. What Do You Mean By Overflow And Underflow?

Answer :

When new data is to be inserted into the statistics shape however there is no available space i.E. Unfastened storage list is empty this situation is known as overflow.

When we want to delete statistics from a statistics structure that is empty this situation is called underflow.

Question 15. What Are The Disadvantages Array Implementations Of Linked List?

Answer :

i) The no of nodes wanted can’t be expected when the program is written.
Ii) The no of nodes declared ought to stay allocated throughout its execution.

Database Administration Interview Questions
Question 16. What Is A Queue?

Answer :

A queue is an ordered collection of gadgets from which gadgets may be deleted at one give up (front quit) and objects inserted at the alternative cease (rear stop).

It obeys FIFO rule there's no restrict to the number of elements a queue contains.

Maven Tutorial
Question 17. What Is A Priority Queue?

Answer :

The precedence queue is a information structure in which the intrinsic ordering of the elements (numeric or alphabetic)

Determines the end result of its simple operation. It is of  kinds:

i) Ascending priority queue- Here smallest object can be removed (insertion is bigoted).
Ii) Descending precedence queue- Here biggest item can be eliminated (insertion is bigoted).

CSS Advanced Interview Questions
Question 18. What Are The Disadvantages Of Sequential Storage?

Answer :

i) Fixed amount of storage remains allotted to the data shape even if it consists of much less detail.
Ii) No more than constant quantity of garage is allocated causing overflow.

DBMS Interview Questions
Question 19. What Are The Disadvantages Of Representing A Stack Or Queue By A Linked List?

Answer :

i) A node in a linked listing (information and next area) occupies more garage than a corresponding element in an array.
Ii) Additional time spent in handling the available list.

Object Oriented Analysis and Design Tutorial
Question 20. What Is Dangling Pointer And How To Avoid It?

Answer :

After a name to unfastened(p) makes a next reference to *p unlawful, i.E. Even though the storage to p is freed but the price of p(deal with) continue to be unchanged .So the item at that address may be used because the fee of *p (i.E. There may be no manner to come across the illegality).Here p is known as dangling pointer.

To avoid this it's miles better to set p to NULL after executing unfastened(p).The null pointer cost doesn’t reference a garage area it is a pointer that doesn’t point to whatever.

Maven Interview Questions
Question 21. What Are The Disadvantages Of Linear List?

Answer :

i) We cannot attain any of the nodes that precede node (p).
Ii) If a listing is traversed, the external pointer to the listing need to be continued so one can reference the list once more.

Question 22. Define Circular List?

Answer :

In linear list the next subject of the final node incorporate a null pointer, while a next field in the remaining node contain a pointer returned to the primary node it's miles called circular list.

Advantages – From any factor inside the listing it's far feasible to reach at every other factor.

Question 23. What Are The Disadvantages Of Circular List?

Answer :

i) We can’t traverse the list backward.
Ii) If a pointer to a node is given we cannot delete the node.

Computer architecture Interview Questions
Question 24. Define Double Linked List?

Answer :

It is a group of facts factors referred to as nodes,

wherein every node is split into three components:

An information area that consists of the statistics saved inside the node.
Left field that incorporate pointer to node on left aspect.
Right field that incorporate pointer to node on proper facet.
Adv Java Interview Questions
Question 25. Is It Necessary To Sort A File Before Searching A Particular Item ?

Answer :

If much less paintings is involved in looking a element than to kind after which extract, then we don’t go for sort.

If common use of the record is required for the cause of retrieving particular element, it's miles greater efficient to sort the document.

Thus it relies upon on state of affairs.

Question 26. What Are The Issues That Hamper The Efficiency In Sorting A File?

Answer :

The issues are:

Length of time required via the programmer in coding a particular sorting application.
Amount of gadget time vital for jogging the unique application.
The quantity of area essential for the precise program .
Object Oriented Analysis and Design Interview Questions
Question 27. Calculate The Efficiency Of Sequential Search?

Answer :

The variety of comparisons relies upon on wherein the document with the argument key seems inside the desk.

If it seems before everything role then one contrast
If it appears at final function then n comparisons
Average=(n+1)/2 comparisons
Unsuccessful seek n comparisons
Number of comparisons anyhow is O (n).
Core Java Interview Questions
Question 28. Is Any Implicit Arguments Are Passed To A Function When It Is Called?

Answer :

Yes there's a hard and fast of implicit arguments that contain statistics vital for the function to execute and return efficaciously. One of them is go back address which is stored inside the characteristic’s information vicinity, at the time of returning to calling software the cope with is retrieved and the feature branches to that location.

Question 29. Parenthesis Is Never Required In Postfix Or Prefix Expressions, Why?

Answer :

Parenthesis isn't required because the order of the operators within the postfix /prefix expressions determines the real order of operations in evaluating the expression.

Standard Template Library (STL) Interview Questions
Question 30. List Out The Areas In Which Data Structures Are Applied Extensively?

Answer :

Compiler Design,
Operating System,
Database Management System,
Statistical analysis package,
Numerical Analysis,
Graphics,
Artificial Intelligence,
Simulation.
Question 31. What Are The Major Data Structures Used In The Following Areas : Network Data Model & Hierarchical Data Model?

Answer :

RDBMS – Array (i.E. Array of systems)
Network statistics version – Graph
Hierarchical records model – Trees

Question 32. If You Are Using C Language To Implement The Heterogeneous Linked List, What Pointer Type Will You Use?

Answer :

The heterogeneous linked listing incorporates distinctive facts types in its nodes and we want a link, pointer to attach them. It is not possible to use regular guidelines for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a common pointer type.

Xml Publisher Interview Questions
Question 33. Minimum Number Of Queues Needed To Implement The Priority Queue?

Answer :

Two. One queue is used for real storing of facts and some other for storing priorities.

C Interview Questions
Question 34. What Is The Data Structures Used To Perform Recursion?

Answer :

Stack. Because of its LIFO (Last In First Out) property it recalls its ‘caller’ so knows whom to go back while the feature has to go back. Recursion makes use of device stack for storing the go back addresses of the function calls.

Every recursive function has its equal iterative (non-recursive) characteristic. Even whilst such equivalent iterative procedures are written, express stack is for use.

Question 35. What Are The Notations Used In Evaluation Of Arithmetic Expressions Using Prefix And Postfix Forms?

Answer :

Polish and Reverse Polish notations.

Question 36. Convert The Expression ((a + B) * C - (d - E) ^ (f + G)) To Equivalent Prefix And Postfix Notations?

Answer :

Prefix Notation:

^ – * +ABC – DE + FG

postfix Notation:

AB + C * DE – – FG + ^

Database Administration Interview Questions
Question 37. List Out Few Of The Application Of Tree Data-shape?

Answer :

The manipulation of Arithmetic expression, Symbol Table construction & Syntax evaluation.

Question 38. List Out Few Of The Applications That Make Use Of Multilinked Structures?

Answer :

Sparse matrix, Index generation.

Question 39. What Is The Type Of The Algorithm Used In Solving The eight Queens Problem?

Answer :

Backtracking.

Question 40. In An Avl Tree, At What Condition The Balancing Is To Be Done?

Answer :

If the ‘pivotal value’ (or the ‘Height element’) is greater than 1 or less than –1.

CSS Advanced Interview Questions
Question 41. There Are 8, 15, thirteen, 14 Nodes Were There In four Different Trees. Which Of Them Could Have Formed A Full Binary Tree?

Answer :

 In wellknown: There are 2n-1 nodes in a complete binary tree. By the method of removal:

Full binary timber include extraordinary wide variety of nodes. So there can not be complete binary timber with 8 or 14 nodes, so rejected. With 13 nodes you can shape a complete binary tree but now not a complete binary tree. So the right answer is 15.

Question forty two. In Rdbms, What Is The Efficient Data Structure Used In The Internal Storage Representation?

Answer :

B+ tree. Because in B+ tree, all of the records is saved simplest in leaf nodes, that makes looking less complicated. This corresponds to the statistics that will be saved in leaf nodes.

Maven Interview Questions
Question forty three. What Is A Spanning Tree?

Answer :

A spanning tree is a tree related to a network. All the nodes of the graph seem at the tree once. A minimum spanning tree is a spanning tree prepared so that the entire area weight between nodes is minimized.

Question forty four. Does The Minimal Spanning Tree Of A Graph Give The Shortest Distance Between Any 2 Specified Nodes?

Answer :

No! Minimal spanning tree assures that the entire weight of the tree is stored at its minimum. But it doesn’t suggest that the distance among any  nodes involved within the minimum-spanning tree is minimum.

Question 45. Difference Between Calloc And Malloc ?

Answer :

malloc: allocate n bytes.
Calloc: allocate m times n bytes initialized to zero.

Question 46. What Are The Major Data Structures Used In The Following Areas : Rdbms, Network Data Model & Hierarchical Data Model?

Answer :

RDBMS Array (i.E. Array of structures)
Network facts model Graph
Hierarchical data model Trees.
Question forty seven. Which File Contains The Definition Of Member Functions?

Answer :

Definitions of member features for the Linked List magnificence are contained inside the LinkedList.Cpp record.

Question 48. How Is Any Data Structure Application Is Classified Among Files?

Answer :

A related listing application can be organized into a header record, source document and fundamental application report. The first document is the header record that carries the definition of the NODE structure and the LinkedList magnificence definition. The second report is a source code record containing the implementation of member capabilities of the LinkedList class. The remaining record is the utility document that includes code that creates and uses the LinkedList class.

Question forty nine. What Member Function Places A New Node At The End Of The Linked List?

Answer :

The appendNode() member function places a new node on the cease of the related listing. The appendNode() requires an integer representing the contemporary information of the node.

Question 50. What Is Linked List ?

Answer :

Linked List is one of the essential statistics structures. It consists of a chain of ? Nodes, every containing arbitrary records fields and one or two (”links”) pointing to the following and/or previous nodes. A connected listing is a self-referential datatype as it includes a pointer or hyperlink to every other data of the same kind. Linked lists permit insertion and elimination of nodes at any point inside the list in regular time, however do now not permit random get right of entry to.

Question 51. What Does Each Entry In The Link List Called?

Answer :

Each entry in a linked listing is called a node. Think of a node as an access that has 3 sub entries. One sub access incorporates the data, which can be one characteristic or many attributes. Another points to the previous node, and the ultimate points to the next node. When you input a new object on a related listing, you allocate the brand new node after which set the pointers to previous and subsequent nodes.

Question 52. How Is The Front Of The Queue Calculated ?

Answer :

The front of the queue is calculated via the front = (the front+1) % length.

Question 53. Why Is The Isempty() Member Method Called?

Answer :

The isEmpty() member approach is known as within the dequeue process to decide if there is an object within the queue to be removed i.E. IsEmpty() is known as to decide whether the queue has at the least one element. This approach is called with the aid of the dequeue() method before returning the front element.

Question 54. Which Process Places Data At The Back Of The Queue?

Answer :

Enqueue is the system that locations statistics in the back of the queue.

Question fifty five. What Is The Relationship Between A Queue And Its Underlying Array?

Answer :

Data saved in a queue is sincerely stored in an array. Two indexes, front and quit can be used to perceive the start and cease of the queue.

When an element is removed front may be incremented by 1. In case it reaches beyond the ultimate index to be had it will be reset to 0. Then it will be checked with end. If it's miles more than cease queue is empty.

When an detail is brought cease can be incremented with the aid of 1. In case it reaches past the remaining index to be had it is going to be reset to 0. After incrementing it will be checked with the front. If they may be same queue is full.

Question 56. What Is A Queue ?

Answer :

A Queue is a sequential corporation of records. A queue is a first in first out type of records structure. An element is inserted at the ultimate function and an element is constantly taken out from the primary function.

Question 57. What Does Isempty() Member Method Determines?

Answer :

isEmpty() checks if the stack has at the least one element. This approach is called through Pop() before retrieving and returning the pinnacle element.

Question 58. What Method Removes The Value From The Top Of A Stack?

Answer :

The pop() member technique eliminates the fee from the top of a stack, that is then returned by way of the pop() member method to the announcement that calls the pop() member approach.

Question fifty nine. What Method Is Used To Place A Value Onto The Top Of A Stack?

Answer :

push() method, Push is the route that statistics is being brought to the stack. Push() member approach locations a fee onto the top of a stack.

Question 60. Run Time Memory Allocation Is Known As ?

Answer :

Allocating memory at runtime is referred to as a dynamically allocating reminiscence. In this, you dynamically allocate reminiscence via the usage of the brand new operator when maintaining the array.

As an example : int grades[] = new int[10];

Question 61. How Do You Assign An Address To An Element Of A Pointer Array ?

Answer :

We can assign a memory cope with to an element of a pointer array by means of the usage of the address operator, that's the ampersand (&), in an task declaration inclusive of ptemployee[0] = &initiatives[2];

Question sixty two. Why Do We Use A Multidimensional Array?

Answer :

A multidimensional array may be useful to organize subgroups of facts within an array. In addition to organizing statistics stored in factors of an array, a multidimensional array can keep reminiscence addresses of statistics in a pointer array and an array of hints.

Multidimensional arrays are used to keep information in a matrix shape.

E.G; a railway timetable, schedule cannot be saved as a unmarried dimensional array. One can use a three-D array for storing peak, width and duration of each room on every ground of a building.

Question sixty three. What Is Significance Of " * " ?

Answer :

The symbol “*” tells the laptop that you are maintaining a pointer. Actually it relies upon on context.

In a declaration like int *ptr; the ‘*’ tells which you are affirming a pointer.
In a announcement like int i = *ptr; it tells that you need to assign value pointed to by way of ptr to variable i.
The image “*” is likewise known as as Indirection Operator/ Dereferencing Operator.

Question 64. Is Pointer A Variable?

Answer :

Yes, a pointer is a variable and may be used as an element of a structure and as an attribute of a category in some programming languages including C++, however now not Java. However, the contents of a pointer is a reminiscence cope with of some other place of memory, that's usually the memory address of any other variable, element of a structure, or attribute of a category.

Question 65. How Many Parts Are There In A Declaration Statement?

Answer :

There are  major elements, variable identifier and information type and the 0.33 kind is optional which is kind qualifier like signed/unsigned.

Question 66. How Memory Is Reserved Using A Declaration Statement ?

Answer :

Memory is reserved the use of facts kind inside the variable statement. A programming language implementation has predefined sizes for its records sorts.

For instance: 

in C# the statement int i; will reserve 32 bits for variable i.
A pointer statement reserves memory for the cope with or the pointer variable, but no longer for the facts that it will factor to. The memory for the statistics pointed via a pointer must be allocated at runtime.
The reminiscence reserved via the compiler for simple variables and for storing pointer address is allotted at the stack, whilst the reminiscence allocated for pointer referenced data at runtime is allotted at the heap.

Question 67. What Is Impact Of Signed Numbers On The Memory?

Answer :

Sign of the range is the primary bit of the garage allotted for that variety. So you get one bit less for storing the range. For instance if you are storing an 8-bit quantity, with out sign, the range is 0-255. If you make a decision to keep signal you get 7 bits for the quantity plus one bit for the signal. So the range is -128 to +127.

Question 68. What Is Precision?

Answer :

Precision refers the accuracy of the decimal part of a price. Precision is the number of digits allowed after the decimal point.

Question sixty nine. What Is The Difference Between Null And Void Pointer?

Answer :

NULL can be fee for pointer type variables.
VOID is a kind identifier which has not length.
NULL and void are not identical. Example: void* ptr = NULL;

Question 70. What Is The Difference Between Array And Stack?

Answer :

STACK follows LIFO. Thus the object this is first entered will be the closing eliminated.

In array the gadgets can be entered or removed in any order. Basically each member access is completed the usage of index. No strict order is to be observed right here to put off a particular element.

Array may be multidiamensional or onediamensional however stack should be onediamensional. However both are linear data shape.

Question 71. Tell How To Check Whether A Linked List Is Circular ?

Answer :

Create  hints, every set to the start of the listing. Update every as follows:

whilst (pointer1) 

pointer1 = pointer1->subsequent;
pointer2 = pointer2->subsequent;
if(pointer2)pointer2=pointer2->subsequent;
if (pointer1 == pointer2) 

print (”circularn”);


Question seventy two. Whether Linked List Is Linear Or Non-linear Data Structure?

Answer :

According to Access techniques Linked list is a linear one.
According to Storage Linked List is a Non-linear one.
Question 73. If You Are Using C Language To Implement The Heterogeneous Linked List, What Pointer Type Will You Use?

Answer :

The heterogeneous related list carries exceptional facts sorts in its nodes and we need a hyperlink, pointer to attach them. It is not feasible to use regular guidelines for this. So we pass for void pointer. Void pointer is capable of storing pointer to any kind as it's far a commonplace pointer type.

Question seventy four. What Is A Node Class?

Answer :

A node elegance is a category that, is based on the bottom magnificence for services and implementation, affords a wider interface to users than its base class, relies typically on digital functions in its public interface depends on all its direct and indirect base elegance may be understood only in the context of the base elegance can be used as base for in addition derivation may be used to create gadgets. A node class is a class that has added new offerings or capability past the offerings inherited from its base magnificence.

Question 75. When Can You Tell That A Memory Leak Will Occur?

Answer :

A reminiscence leak takes place whilst a program loses the capacity to loose a block of dynamically allocated reminiscence.

Question seventy six. How Many Different Trees Are Possible With 10 Nodes ?

Answer :

1014 - For instance, don't forget a tree with 3 nodes(n=3), it will have the maximum combination of five exclusive (ie, 23 - 3 =? Five) timber.

Question 77. How Can I Search For Data In A Linked List?

Answer :

Unfortunately, the handiest way to look a linked listing is with a linear search, due to the fact the best manner a related list's members may be accessed is sequentially. Sometimes it is quicker to take the data from a related listing and keep it in a different statistics structure so that searches can be extra green.

Question seventy eight. Define Data Structures?

Answer :

Data Structures is described as the way of organizing all records gadgets that don't forget no longer only the elements saved but additionally stores the connection between the factors.

Question 79. Define Primary Data Structures?

Answer :

Primary records structures are the simple data systems that at once function upon the device instructions. All the basic constants (integers, floating-factor numbers, character constants, string constants) and suggestions are considered as number one records systems.

Question 80. Define Static Data Structures?

Answer :

A statistics structure formed whilst the range of statistics gadgets are regarded earlier is referred as static data shape or fixed length facts structure.

Question 81. List Some Of The Static Data Structures In C?

Answer :

Some of the static facts structures in C are arrays, tips, systems and so forth.

Question 82. Define Dynamic Data Structures?

Answer :

A information shape shaped when the number of records objects are not acknowledged earlier is referred to as dynamic records shape or variable size records shape.

Question eighty three. List Some Of The Dynamic Data Structures In C?

Answer :

Some of the dynamic records systems in C are linked lists, stacks, queues, timber and so on.

Question eighty four. Define Linear Data Structures?

Answer :

Linear information systems are statistics systems having a linear relationship between its adjacent factors.

Eg; Linked lists.

Question eighty five. Define Non-linear Data Structures?

Answer :

Non-linear statistics systems are facts structures that don’t have a linear dating between its adjacent factors but have a hierarchical relationship between the factors.

Eg; Trees and Graphs.

Question 86. Define Linked Lists?

Answer :

Linked listing consists of a chain of systems, which aren't necessarily adjacent in memory. Each shape contains the detail and a pointer to a structure containing its successor. We name this the Next Pointer. The closing cell’s Next pointer points to NULL.

Question 87. State The Different Types Of Linked Lists?

Answer :

The exclusive styles of related list include singly connected list, doubly linked list and circular connected listing.

Question 88. List The Basic Operations Carried Out In A Linked List?

Answer :

The basic operations accomplished in a connected listing encompass:

Creation of a list.
Insertion of a node.
Deletion of a node.
Modification of a node.
Traversal of the list.
Question 89. List Out The Advantages Of Using A Linked List?

Answer :

It isn't necessary to specify the variety of factors in a connected list during its announcement.
Linked listing can develop and decrease in size relying upon the insertion and deletion that happens in the listing.
Insertions and deletions at any place in a list may be dealt with without problems and effectively.
A connected listing does no longer waste any memory area.
Question ninety. List Out The Disadvantages Of Using A Linked List?

Answer :

Searching a selected detail in a listing is hard and time consuming.
A linked listing will use more garage space than an array to save the identical variety of factors.
Question 91. List Out The Applications Of A Linked List?

Answer :

Some of the crucial applications of connected lists are manipulation of polynomials, sparse matrices, stacks and queues.

Question ninety two. State The Difference Between Arrays And Linked Lists?

Answer :

Submit 

Question ninety three. Define A Stack?

Answer :

Stack is an ordered collection of elements wherein insertions and deletions are limited to at least one stop. The stop from which factors are added and/or eliminated is called pinnacle of the stack. Stacks also are referred as piles, push-down lists and final-in-first-out (LIFO) lists.

Question 94. List Out The Basic Operations That Can Be Performed On A Stack ?

Answer :

The primary operations that may be performed on a stack are

Push operation.
Pop operation.
Peek operation.
Empty take a look at.
Fully occupied take a look at.
Question ninety five. State The Different Ways Of Representing Expressions?

Answer :

The distinct ways of representing expressions are

Infix Notation.
Prefix Notation.
Postfix Notation.
Question ninety six. State The Advantages Of Using Infix Notations?

Answer :

It is the mathematical way of representing the expression.
It is less complicated to see visually which operation is accomplished from first to last.
Question 97. State The Advantages Of Using Postfix Notations?

Answer :

Need no longer fear about the rules of precedence.
Need now not worry approximately the guidelines for proper to left associativity.
Need not need parenthesis to override the above guidelines.
Question ninety eight. State The Rules To Be Followed During Infix To Postfix Conversions?

Answer :

Fully parenthesize the expression beginning from left to proper. During parenthesizing, the operators having better priority are first parenthesized.
Move the operators one at a time to their right, such that every operator replaces their corresponding proper parenthesis.
The a part of the expression, which has been transformed into postfix is to be dealt with as unmarried operand.
Once the expression is transformed into postfix shape, take away all parenthesis.
Question 99. State The Rules To Be Followed During Infix To Prefix Conversions?

Answer :

Fully parenthesize the expression starting from left to proper. During parenthesizing, the operators having better precedence are first parenthesized.
Move the operators separately to their left, such that each operator replaces their corresponding left  parenthesis.
The a part of the expression, which has been transformed into prefix is to be dealt with as single operand.
Once the expression is converted into prefix shape, eliminate all parenthesis.
Question a hundred. State The Difference Between Stacks And Linked Lists?

Answer :

The distinction between stacks and linked lists is that insertions and deletions may additionally occur anywhere in a connected list, but most effective at the top of the stack.

Question one zero one. Mention The Advantages Of Representing Stacks Using Linked Lists Than Arrays?

Answer :

It isn't always vital to specify the variety of elements to be stored in a stack in the course of its announcement, in view that memory is allotted dynamically at run time while an element is introduced to the stack.
Insertions and deletions can be dealt with easily and successfully.
Linked list illustration of stacks can develop and reduce in size without wasting memory space, depending upon the insertion and deletion that takes place in the listing.
Multiple stacks may be represented efficiently the use of a series for each stack.
Question 102. Define A Queue?

Answer :

Queue is an ordered series of factors wherein insertions are constrained to 1 give up referred to as the rear give up and deletions are restricted to different end known as the front give up. Queues also are referred as First-In-First-Out (FIFO) Lists.

Question 103. Define A Priority Queue?

Answer :

Priority queue is a collection of elements, each containing a key referred as the priority for that detail. Elements can be inserted in any order (i.E., of alternating precedence), however are organized in order of their priority value inside the queue. The elements are deleted from the queue within the order of their precedence (i.E., the factors with the very best precedence is deleted first). The factors with the same precedence are given identical significance and processed as a result.

Question 104. State The Difference Between Queues And Linked Lists?

Answer :

The difference among queues and connected lists is that insertions and deletions may additionally arise everywhere within the linked listing, however in queues insertions can be made handiest in the rear stop and deletions can be made handiest inside the the front cease.

Question one hundred and five. Define A Deque?

Answer :

Deque (Double-Ended Queue) is some other shape of a queue wherein insertions and deletions are made at each the the front and rear ends of the queue. There are  versions of a deque, namely, input confined deque and output restrained deque. The input limited deque lets in insertion at one cease (it can be both the front or rear) most effective. The output limited deque permits deletion at one quit (it may be either the front or rear) simplest.

Question 106. Why You Need A Data Structure?

Answer :

A facts shape helps you to recognize the relationship of 1 facts detail with the other and prepare it within the memory. Sometimes the agency is probably easy and can be very actually visioned.

Eg; List of names of months in a yr –Linear Data Structure, List of historic locations inside the international- Non-Linear Data Structure. A records shape facilitates you to investigate the statistics, save it and prepare it in a logical and mathematical manner.

Question 107. What Do You Mean By Shortest Path?

Answer :

A path having minimal weight between two vertices is referred to as shortest path, in which weight is always a high-quality number.

Question 108. What Do You Mean By Articulation Point?

Answer :

If a graph is not biconnected, the vertices whose elimination would disconnect the graph are referred to as articulation factors.

Question 109. Define Biconnectivity?

Answer :

A linked graph G is stated to be biconnected, if it stays linked after elimination of anyone vertex and the edges which are incident upon that vertex. A linked graph is biconnected, if it has no articulation points.

Question one hundred ten. What Do You Mean By Back Edge?

Answer :

If w is the ancestor of v, then vw is called a back edge.

Question 111. What Do You Mean By Tree Edge?

Answer :

If w is undiscovered at the time vw is explored, then vw is known as a tree facet and v will become the determine of w.

Question 112. Differentiate Bfs And Dfs?

Answer :

Submit 

Question 113. What Do You Mean By Breadth First Search (bfs)?

Answer :

BFS plays simultaneous explorations beginning from a not unusual point and spreading out independently.

Question 114. List The Two Important Key Points Of Depth First Search?

Answer :

i) If direction exists from one node to some other node, stroll across the edge – exploring the threshold.
Ii) If direction does not exist from one precise node to every other node, go back to the preceding node in which we were before – backtracking.

Question 115. Define Graph Traversals?

Answer :

Traversing a graph is an effective manner to visit each vertex and edge precisely as soon as.

Question 116. Name Two Algorithms Two Find Minimum Spanning Tree?

Answer :

Kruskal’s set of rules.
Prim’s algorithm.
Question 117. What Is A Minimum Spanning Tree?

Answer :

A minimal spanning tree of an undirected graph G is a tree shaped from graph edges that connects all of the vertices of G at the bottom general cost.

Question 118. What Are The Two Traversal Strategies Used In Traversing A Graph?

Answer :

Breadth first seek
Depth first seek
Question 119. When Is A Graph Said To Be Weakly Connected?

Answer :

When a directed graph isn't strongly connected however the underlying graph is connected, then the graph is said to be weakly related.

Question a hundred and twenty. What Is Meant By Strongly Connected In A Graph?

Answer :

An undirected graph is attached, if there may be a route from every vertex to every other vertex. A directed graph with this property is known as strongly linked.

Question 121. What Is An Acyclic Graph?

Answer :

A easy diagram which does not have any cycles is referred to as an acyclic graph.

Question 122. What Is A Cycle Or A Circuit?

Answer :

A direction which originates and ends within the same node is referred to as a cycle or circuit.

Question 123. What Is A Simple Path?

Answer :

A route in a diagram wherein the edges are distinct is known as a simple route. It is also referred to as as part simple.

Question 124. Define Path In A Graph?

Answer :

The path in a graph is the course taken to attain terminal node from a starting node.

Question 125. Define Indegree Of A Graph?

Answer :

In a directed graph, for any node v, the quantity of edges that have v as their terminal node is known as the indegree of the node v.

Question 126. Define Outdegree Of A Graph?

Answer :

In a directed graph, for any node v, the wide variety of edges that have v as their initial node is referred to as the out degree of the node v.

Question 127. What Is A Weighted Graph?

Answer :

A graph wherein weights are assigned to every aspect is known as a weighted graph.

Question 128. What Is A Simple Graph?

Answer :

A easy graph is a graph, which has no longer multiple edge among a pair of nodes than the sort of graph is known as a simple graph.

Question 129. What Is A Loop?

Answer :

An fringe of a graph which connects to itself is known as a loop or sling.

Question one hundred thirty. What Is A Undirected Graph?

Answer :

A graph wherein each aspect is undirected is known as a directed graph.

Question 131. What Is A Directed Graph?

Answer :

A graph in which each aspect is directed is called a directed graph.

Question 132. Define Adjacent Nodes?

Answer :

Any  nodes that are linked by means of an area in a graph are called adjoining nodes. For instance, if an side x ε E is associated with a pair of nodes (u,v) in which u, v ε V, then we are saying that the edge x connects the nodes u and v.

Question 133. Define Graph?

Answer :

A graph G encompass a nonempty set V that's a hard and fast of nodes of the graph, a hard and fast E that is the set of edges of the graph, and a mapping from the set for part E to a set of pairs of elements of V. It can also be represented as G=(V, E).

Question 134. What Is The Need For Path Compression?

Answer :

Path compression is achieved at some stage in a Find operation. Suppose if we need to perform Find(X), then the impact of direction compression is that every node at the course from X to the root has its parent modified to the basis.

Question a hundred thirty five. What Do You Mean By Union-by using-weight?

Answer :

Keep track of the burden ie; length of every tree and constantly append the smaller tree to the bigger one while acting UNION.

Question 136. List The Abstract Operations In The Set?

Answer :

Let S and T be units and e be an detail.

SINGLETON(e) returns e.
UNION(S,T) returns S ? T.
INTERSECTION(S,T) returns S ∩ T.
FIND returns the call of the set containing a given element.
Question 137. Define A Set?

Answer :

A set S is an unordered collection of factors from a universe. An detail cannot appear greater than as soon as in S. The cardinality of S is the wide variety of elements in S. An empty set is a set whose cardinality is 0. A singleton set is a hard and fast whose cardinality is one.

Question 138. What Do You Mean By Disjoint Set Adt?

Answer :

A collection of non-empty disjoint units S=S1,S2,….,Sk i.E;each Si is a non-empty set that has no element in not unusual with any other Sj. In mathematical notation this is: Si∩Sj=?. Each set is diagnosed with the aid of a unique detail known as its representative.

Question 139. List The Applications Of Set Adt?

Answer :

Maintaining a set of connected additives of a graph.
Maintain listing of reproduction copies of net pages.
Constructing a minimal spanning tree for a graph.
Question one hundred forty. Define An Equivalence Relation?

Answer :

An equivalence relation is a relation R that satisfies three homes:

(Reflexive) aRa, for all a ε S.
(Symmetric) aRb if and only if bRa.
(Transitive) aRb and bRc means that aRc.
Question 141. Define A Relation?

Answer :

A relation R is defined on a hard and fast S if for each pair of factors (a,b), a,b ε S, aRb is both actual or fake. If aRb is actual, then we are saying that a is associated with b.

Question 142. Mention One Advantage And Disadvantage Of Using Quadratic Probing?

Answer :

Advantage: The problem of primary clustering is eliminated.
Disadvantage: There is not any guarantee of finding an unoccupied cell once the desk is nearly 1/2 full.

Question 143. List The Limitations Of Linear Probing?

Answer :

Time taken for locating the following available cellular is massive.
In linear probing, we come across a hassle known as clustering.
Question one hundred forty four. What Is The Need For Extendible Hashing?

Answer :

If either open addressing hashing or separate chaining hashing is used, the foremost trouble is that collisions could cause several blocks to be tested for the duration of a Find, even for a properly-allotted hash desk. Extendible hashing allows a find to be achieved in  disk accesses. Insertions additionally require few disk accesses.

Question one hundred forty five. What Do You Mean By Rehashing?

Answer :

If the desk gets too complete, the jogging time for the operations will begin taking too long and inserts would possibly fail for open addressing with quadratic decision. A solution to this is to build any other desk this is approximately twice as large with the related new hash characteristic and scan down the entire authentic hash desk, computing the new hash price for every detail and inserting it in the new table. This entire operation is called rehashing.

Question 146. What Do You Mean By Double Hashing?

Answer :

Double hashing is an open addressing collision decision approach wherein F(i)=i.Hash2(X). This method says that we apply a second hash feature to X and probe at a distance hash2(X), 2hash2(X),….,and so forth. A characteristic such as hash2(X)=R-(XmodR), with R a prime smaller than Tablesize.

Question 147. What Do You Mean By Secondary Clustering?

Answer :

Although quadratic probing removes primary clustering, factors that hash to the identical function will probe the identical opportunity cells. This is referred to as secondary clustering.

Question 148. What Do You Mean By Quadratic Probing?

Answer :

Quadratic probing is an open addressing collision resolution approach in which F(i)=i2. There isn't any assure of locating an empty cell as soon as the desk receives 1/2 full if the desk length is not prime. This is because at most half of the table may be used as opportunity places to clear up collisions.

Question 149. What Do You Mean By Primary Clustering?

Answer :

In linear probing collision decision method, despite the fact that the table is tremendously empty, blocks of occupied cells begin forming. This effect is called primary clustering method that any key hashes into the cluster will require several attempts to resolve the collision after which it will add to the cluster.

Question a hundred and fifty. What Do You Mean By Linear Probing?

Answer :

Linear probing is an open addressing collision resolution method in which F is a linear feature of i, F(i)=i. This quantities to attempting sequentially in search of an empty cell. If the table is big enough, a unfastened mobile can constantly be determined, but the time to accomplish that can get pretty big.

Question 151. What Do You Mean By Probing?

Answer :

Probing is the method of getting next available hash desk array cellular.

Question 152. What Are The Types Of Collision Resolution Strategies In Open Addressing?

Answer :

Linear probing.
Quadratic probing.
Double hashing.
Question 153. What Do You Mean By Open Addressing?

Answer :

Open addressing is a collision resolving approach wherein, if collision takes place alternative cells are tried until an empty mobile is observed. The cells h0(x), h1(x), h2(x),…. Are tried in succession, wherein hi(x)=(Hash(x)+F(i))mod Tablesize with F(0)=0. The characteristic F is the collision decision strategy.

Question 154. Write The Disadvantages Of Separate Chaining?

Answer :

The factors are lightly allotted. Some factors may also have extra elements and some may not have anything.
It requires tips. This ends in slow the algorithm down a chunk due to the time required to allocate new cells, and additionally basically calls for the implementation of a second data structure.
Question 155. W




CFG