ronaldweinland.info Question Papers DATA STRUCTURES INTERVIEW QUESTIONS AND ANSWERS FOR EXPERIENCED PDF

DATA STRUCTURES INTERVIEW QUESTIONS AND ANSWERS FOR EXPERIENCED PDF

Thursday, April 18, 2019 admin Comments(0)

DATA STRUCTURES Interview Questions and Answers pdf free CIVIL | Mechanical | CSE | EEE | ECE | IT | Chemical Online Quiz Tests for Freshers. A data structure is a way of organizing data that considers not only the. What is data structure? A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance. HOME interview Questions MCQs *LAB VIVA CLASS NOTES SEMINAR TOPICS and Answers 2 MCQ PDF Data Structures and Algorithms Multiple Choice .. viva questions and answers,online quiz test pdf free download for freshers.


Author:JOSEPH MCFERRIN
Language:English, Spanish, French
Country:Portugal
Genre:Politics & Laws
Pages:763
Published (Last):09.04.2015
ISBN:313-2-23073-353-6
ePub File Size:18.73 MB
PDF File Size:15.76 MB
Distribution:Free* [*Register to download]
Downloads:24981
Uploaded by: JILLIAN

When dealing with data structure, we not only focus on one piece of data, but rather different set of data and how they can relate to one another in Top 50 Data Structures Interview Questions & Answers .. Download PDF. Here is a list of important interview questions about Data structures (with answers).Download Complete PDF ronaldweinland.info Structures are the main basics of. Contains Important Data structures Interview Questions with Answers and Data Questions based on Data structure, check your knowledge and test your Data structure Interview Questions and Answers For Freshers/Experienced | Data and Answers PDF | Interview Questions in Data structure | Data structure eBooks .

It seeks to find ways to make data access more efficient. When dealing with the data structure, we not only focus on one piece of data but the different set of data and how they can relate to one another in an organized manner. The key difference between both the data structure is the memory area that is being accessed. When dealing with the structure that resides the main memory of the computer system, this is referred to as storage structure. When dealing with an auxiliary structure, we refer to it as file structures. A binary search is an algorithm that is best applied to search a list when the elements are already in order or sorted. The list is searched starting in the middle, such that if that middle value is not the target search key, it will check to see if it will continue the search on the lower half of the list or the higher half.

A path which originates and ends in the same node is called a cycle or circuit. What Is A Simple Path? A path in a diagram in which the edges are distinct is called a simple path. It is also called as edge simple. Define Path In A Graph? The path in a graph is the route taken to reach terminal node from a starting node.

Define Indegree Of A Graph? In a directed graph, for any node v, the number of edges which have v as their terminal node is called the indegree of the node v. Define Outdegree Of A Graph? In a directed graph, for any node v, the number of edges which have v as their initial node is called the out degree of the node v.

What Is A Weighted Graph? A graph in which weights are assigned to every edge is called a weighted graph.

What Is A Simple Graph? A simple graph is a graph, which has not more than one edge between a pair of nodes than such a graph is called a simple graph. What Is A Loop? An edge of a graph which connects to itself is called a loop or sling. What Is A Undirected Graph? A graph in which every edge is undirected is called a directed graph. What Is A Directed Graph?

A graph in which every edge is directed is called a directed graph. Define Adjacent Nodes?

Important Data Structures Interview Questions with Answers

Any two nodes which are connected by an edge in a graph are called adjacent nodes. A graph G consist of a nonempty set V which is a set of nodes of the graph, a set E which is the set of edges of the graph, and a mapping from the set for edge E to a set of pairs of elements of V. Path compression is performed during a Find operation. Suppose if we want to perform Find X , then the effect of path compression is that every node on the path from X to the root has its parent changed to the root.

Keep track of the weight ie; size of each tree and always append the smaller tree to the larger one when performing UNION. A set S is an unordered collection of elements from a universe. An element cannot appear more than once in S. The cardinality of S is the number of elements in S. An empty set is a set whose cardinality is zero. A singleton set is a set whose cardinality is one. In mathematical notation this is: Each set is identified by a unique element called its representative.

Maintaining a set of connected components of a graph. Maintain list of duplicate copies of web pages. Constructing a minimum spanning tree for a graph. Define An Equivalence Relation? An equivalence relation is a relation R that satisfies three properties:. Define A Relation? If aRb is true, then we say that a is related to b. The problem of primary clustering is eliminated. There is no guarantee of finding an unoccupied cell once the table is nearly half full.

Time taken for finding the next available cell is large. In linear probing, we come across a problem known as clustering. If either open addressing hashing or separate chaining hashing is used, the major problem is that collisions could cause several blocks to be examined during a Find, even for a well-distributed hash table.

Extendible hashing allows a find to be performed in two disk accesses. Insertions also require few disk accesses. If the table gets too full, the running time for the operations will start taking too long and inserts might fail for open addressing with quadratic resolution. A solution to this is to build another table that is about twice as big with the associated new hash function and scan down the entire original hash table, computing the new hash value for each element and inserting it in the new table.

This entire operation is called rehashing. This formula says that we apply a second hash function to X and probe at a distance hash2 X , 2hash2 X ,…. Although quadratic probing eliminates primary clustering, elements that hash to the same position will probe the same alternative cells.

This is known as secondary clustering.

+ TOP DATA STRUCTURES Interview Questions and Answers pdf

There is no guarantee of finding an empty cell once the table gets half full if the table size is not prime. This is because at most half of the table can be used as alternative locations to resolve collisions. In linear probing collision resolution strategy, even if the table is relatively empty, blocks of occupied cells start forming.

This effect is known as primary clustering means that any key hashes into the cluster will require several attempts to resolve the collision and then it will add to the cluster.

This amounts to trying sequentially in search of an empty cell. If the table is big enough, a free cell can always be found, but the time to do so can get quite large. Probing is the process of getting next available hash table array cell. Linear probing. Quadratic probing. Double hashing. Open addressing is a collision resolving strategy in which, if collision occurs alternative cells are tried until an empty cell is found.

The function F is the collision resolution strategy.

Commonly Asked Data Structure Interview Questions | Set 1

The elements are evenly distributed. Some elements may have more elements and some may not have anything.

It requires pointers. This leads to slow the algorithm down a bit because of the time required to allocate new cells, and also essentially requires the implementation of a second data structure.

More number of elements can be inserted as it uses linked lists. Separate chaining is a collision resolution technique to keep the list of all elements that hash to the same value. This is called separate chaining because each hash table element is a separate chain linked list. Each linked list contains all the elements whose keys hash to the same index. Separate chaining or External hashing.

Open addressing or Closed hashing. When an element is inserted, it hashes to the same value as an already inserted element, and then it produces collision. Write The Importance Of Hashing?

Maps key with the corresponding value using hash function. Hash tables support the efficient addition of new entries and the time spent on searching for the required data is independent of the number of items stored. A hash function is a key to address transformation which acts upon a given key to compute the relative position of the key in an array. The choice of hash function should be simple and it must distribute the data evenly. The hash table data structure is merely an array of some fixed size, containing the keys.

A key is a string with an associated value. Each key is mapped into some number in the range 0 to tablesize-1 and placed in the appropriate cell. Define Hashing? Hashing is the transformation of string of characters into a usually shorter fixed length value or key that represents the original string.

Hashing is used to index and retrieve items in a database because it is faster to find the item using the short hashed key than to find it using the original value. When the minimum element is removed, a hole is created at the root. Since the heap now becomes one smaller, it follows that the last element X in the heap must move somewhere in the heap.

If X can be placed in the hole, then we are done.. We repeat this step until X can be placed in the hole. Thus, our action is to place X in its correct spot along a path from the root containing minimum children. This general strategy is known as percolate down. To insert an element, we have to create a hole in the next available heap location.

Inserting an element in the hole would sometimes violate the heap order property, so we have to slide down the parent into the hole.

This strategy is continued until the correct location for the new element is found. This general strategy is known as a percolate up; the new element is percolated up the heap until the correct location is found.

The selection problem. Event simulation. In a heap, for every node X, the key in the parent of X is smaller than or equal to the key in X, with the exception of the root which has no parent. A heap is a binary tree that is completely filled with the possible exception at the bottom level, which is filled from left to right. Such a tree is known as a complete binary tree. Structure Property. Heap Order Property.

In a multiuser environment, the operating system scheduler must decide which of the several processes to run only for a fixed period of time.

One algorithm uses queue. Jobs are initially placed at the end of the queue. The scheduler will repeatedly take the first job on the queue, run it until either it finishes or its time limit is up and place it at the end of the queue if it does not finish. This strategy is not appropriate, because very short jobs will soon to take a long time because of the wait involved in the run. Generally, it is important that short jobs finish as fast as possible, so these jobs should have precedence over jobs that have already been running.

Further more, some jobs that are not short are still very important and should have precedence. This particular application seems to require a special kind of queue, known as priority queue.

Priority queue is also called as Heap or Binary Heap. Database implementation. Indexing on non primary key fields. A B-tree of order 4 is called tree. A B-tree of order 4 is a tree that is not binary with the following structural properties:. A B-tree of order 3 is called tree. A B-tree of order 3 is a tree that is not binary with the following structural properties:.

Define B-tree Of Order M? A B-tree of order M is a tree that is not binary with the following structural properties:. A heap is defined to be a complete binary tree with the property that the value of each node is atleast as small as the value of its child nodes, if they exist. The root node of the heap has the smallest value in the tree.

Let us assume that the splay is performed at vertex v, whose parent and grandparent are p and g respectively. Then, the three rotations are named as:. If p is the root and v is the left child of p, then left-left rotation at p would suffice.

This case always terminates the splay as v reaches the root after this rotation. If p is not the root, p is the left child and v is also a left child, then a left-left rotation at g followed by a left-left rotation at p, brings v as an ancestor of g as well as p.

If p is not the root, p is the left child and v is a right child, perform a left-right rotation at g and bring v as an ancestor of p as well as g. Splaying reduces the total accessing time if the most frequently accessed node is moved towards the root. It does not require to maintain any information regarding the height or balance factor and hence saves space and simplifies the code to some extent.

Define Splay Tree? A splay tree is a binary search tree in which restructuring is done using a scheme called splay.

The splay is a heuristic method which moves a given vertex v to the root of the splay tree using a sequence of rotations.

Data structures Interview Questions

The height of left subtree minus height of right subtree is called balance factor of a node in AVL tree. The height of an empty tree is Then the rotations can be classified into the following four categories:. The newly inserted node is in the left subtree of the left child of A. The newly inserted node is in the right subtree of the right child of A. The newly inserted node is in the right subtree of the left child of A. The newly inserted node is in the left subtree of the right child of A.

Balanced trees have the structure of binary trees and obey binary search tree properties. Apart from these properties, they have some special constraints, which differ from one data structure to another.

However, these constraints are aimed only at reducing the height of the tree, because this factor determines the time complexity. Define Avl Tree? An empty tree is height balanced. Define Left-in Threaded Tree? Define Right-in Threaded Tree? Right-in threaded binary tree is defined as one in which threads replace NULL pointers in nodes with empty right sub-trees. What Is An Expression Tree? An expression tree is a tree which is build from infix or prefix or postfix expression.

Generally, in such a tree, the leaves are operands and other nodes are operators. In threaded binary tree, the NULL pointers are replaced by some addresses. The left pointer of the node points to its predecessor and the right pointer of the node points to its successor.

In binary search tree, the nodes are arranged in such a way that the left node is having less data value than root node value and the right nodes are having larger value than that of root. Because of this while searching any node the value of the target node will be compared with the parent node and accordingly either left sub branch or right sub branch will be searched.

So, one has to compare only particular branches.

Thus searching becomes efficient. Define Ancestor And Descendant? If there is a path from node n1 to n2, then n1 is the ancestor of n2 and n2 is the descendant of n1. General tree is a tree with nodes having any number of children. Define A Binary Search Tree? A binary search tree is a special binary tree, which is either empty or it should satisfy the following characteristics:.

Given a node structure, it is difficult to determine its parent node. Memory spaces are wasted for storing null pointers for the nodes, which have one or no sub-trees.

It requires dynamic memory allocation, which is not possible in some programming language. Insertions and deletions in a node involve no data movement except the rearrangement of pointers, hence less processing time.

Insertions and deletions in a node take an excessive amount of processing time due to data movement up and down the array. Storage method is easy and can be easily implemented in arrays. It requires static memory allocation so it is easily implemented in all programming language. Traverse the left sub-tree. Traverse the right sub-tree. Process the root node. Visiting a node.

Preorder traversal. Inorder traversal. Postorder traversal. Levelorder traversal. Traversing a binary tree means moving through all the nodes in the binary tree, visiting each node in the tree only once. Define A Right-skewed Binary Tree? A right-skewed binary tree is a tree, which has only right child nodes.

Define A Complete Binary Tree? A complete binary tree is a tree in which every non-leaf node has exactly two children not necessarily to be on the same level. Define A Full Binary Tree? A full binary tree is a tree in which all the leaves are on the same level and every non-leaf node has exactly two children. All intermediate nodes that traverse the given tree from its root node to the terminal nodes are referred as non-terminal nodes.

A node that has no children is called a terminal node.

Interview data questions pdf for experienced structures and answers

It is also referred to as leaf node. A path in a tree is a sequence of distinct nodes in which successive nodes are connected by edges in the tree. Define A Binary Tree? A binary tree is a finite set of nodes which is either empty or consists of a root and two disjoint binary trees called the left sub-tree and right sub-tree.

A tree may be defined as a forest in which only a single node root has no predecessors. Any forest consists of a collection of trees. The root node is always considered at level zero, then its adjacent children are supposed to be at level 1 and so on. The depth of the tree is the depth of the deepest leaf. The height of the tree is equal to the height of the root.

Questions answers data structures interview for experienced pdf and

Always depth of the tree is equal to height of the tree. For any node ni, the depth of ni is the length of the unique path from the root to ni. The height of ni is the length of the longest path from ni to a leaf. Define Parent Node? The node which is having further sub-branches is called the parent node of those sub-branches.

Define Internal Nodes? The nodes other than the root and the leaves are called internal nodes. These are the terminal nodes of the tree.

The nodes with degree 0 are always the leaves. Define Degree Of The Node? The total number of sub-trees attached to that node is called the degree of the node. This is the unique node in the tree to which further sub-trees are attached.

A tree is a collection of nodes. If linked lists are required and pointers are not available, then an alternative implementation must be used known as cursor implementation.

List The Applications Of Queues? Jobs submitted to printer Real life line Calls to large companies Access to limited resources in Universities Accessing files from file server. List The Applications Of Stacks? Towers of Hanoi Reversing a string Balanced parenthesis Recursion using stack Evaluation of arithmetic expressions. Linear Queues — The queue has two ends, the front end and the rear end. The rear end is where we insert elements and front end is where we delete elements. We can traverse in a linear queue in only one direction ie from front to rear.

Circular Queues — Another form of linear queue in which the last position is connected to the first position of the list. The circular queue is similar to linear queue has two ends, the front end and the rear end. We can traverse in a circular queue in only one direction ie from front to rear.

Double-Ended-Queue — Another form of queue in which insertions and deletions are made at both the front and rear ends of the queue. To identify and create useful mathematical entities and operations to determine what classes of problems can be solved using these entities and operations. To determine the representation of these abstract entities and to implement the abstract operations on these concrete representation.

Persistent data structures are the data structures which retain their previous state and modifications can be done by performing certain operations on it. Eg Stack Ephemeral data structures are the data structures which cannot retain its previous state. Eg Queues. Primitive data types are the fundamental data types. Eg int, float, double, char Non-primitive data types are user defined data types. Eg Structure, Union and enumerated data types.

It is much easier to debug small routines than large routines It is easier for several people to work on a modular program simultaneously A well-written modular program places certain dependencies in only one routine, making changes easier. Define An Abstract Data Type adt? An abstract data type is a set of operations. Objects such as lists, sets and graphs, along with their operations can be viewed as abstract data types. Data type refers to the kinds of data that variables may hold in the programming language.

Eg int, float, char, double — C. Where S is a tag for user defined data type which defines the structure student and s1 is a variable of data type S. An Abstract data type is the specification of the data type which specifies the logical and mathematical model of the data type. A data type is the implementation of an abstract data type. Data structure refers to the collection of computer variables that are connected in some specific manner.

Data Structures Tutorial. Data Structures Practice Tests. IT Skills. Management Skills. Communication Skills. Business Skills. Digital Marketing Skills. Human Resources Skills. Health Care Skills. Finance Skills. All Courses. All Practice Tests. It is a useful tool for specifying the logical properties of a data type. When a function is called i arguments are passed. In linked list i each element in list contains a field, called a link or pointer which contains the address of the next element.

It takes place when there is minimum amount of space left in storage list or when CPU is ideal. It obeys FIFO rule there is no limit to the number of elements a queue contains.

The priority queue is a data structure in which the intrinsic ordering of the elements numeric or alphabetic Determines the result of its basic operation. It is of two types: Advantages — From any point in the list it is possible to reach at any other point. It is a collection of data elements called nodes, where each node is divided into three parts: An info field that contains the information stored in the node.

Left field that contain pointer to node on left side. Right field that contain pointer to node on right side. Thus it depends on situation. The issues are: Length of time required by the programmer in coding a particular sorting program. Amount of machine time necessary for running the particular program. The amount of space necessary for the particular program.

Polish and Reverse Polish notations. Prefix Notation: Sparse matrix, Index generation. By the method of elimination: For example: Update each as follows: Eg; Linked lists. Eg; Trees and Graphs.

The basic operations carried out in a linked list include: Creation of a list. Insertion of a node. Deletion of a node.

Modification of a node. Traversal of the list. Define A Stack? The basic operations that can be performed on a stack are Push operation. Pop operation. Peek operation. Empty check. Fully occupied check. The different ways of representing expressions are Infix Notation. Prefix Notation. Postfix Notation.

Breadth first search Depth first search Question Define Graph? Let S and T be sets and e be an element. FIND returns the name of the set containing a given element. Define A Set? 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.

The heap is more flexible than the stack. However, the memory of the heap can at times be slower when compared to that stack. 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. 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. Assuming that the data to be inserted is a unique value that is, not an existing entry in the tree , check first if the tree is empty. 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. The smallest element remaining in the subarray is then located next to subscripts 1 through n-1 and switched with the element at subscript 1, thereby placing the second smallest element in the second position. The steps are repeated in the same manner till the last element. 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. 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. 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. Pointers that are used in linked list have various applications in the data structure.

Structures for experienced and answers data pdf questions interview

Most declarations do, with the exemption of pointers. Pointer declaration does not allocate memory for data, but for the address of the pointer variable. Actual memory allocation for the data comes during run-time. When dealing with arrays, data is stored and retrieved using an index that refers to the element number in the data sequence. This means that data can be accessed in any order.

In programming, an array is declared as a variable having a number of indexed elements. The minimum number of queues needed in this case is two. One queue is intended for sorting priorities while the other queue is used for actual storage of data.

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. 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. A dequeue is a double-ended queue. This is a structure wherein elements can be inserted or removed from either end. A bubble sort is one sorting technique that can be applied to data structures such as an array. It works by comparing adjacent elements and exchanges their values if they are out of order.

A linked list typically has two parts: the head and the tail. Between the head and tail lie the actual nodes. Selection sort works by picking the smallest number from the list and placing it at the front. This process is repeated for the second position towards the end of the list.

It is the simplest sort algorithm. A graph is one type of data structure that contains a set of ordered pairs. These ordered pairs are also referred to as edges or arcs and are used to connect nodes where data can be stored and retrieved.

The linear data structure is a structure wherein data elements are adjacent to each other. Examples of linear data structure include arrays, linked lists, stacks, and queues. On the other hand, a non-linear data structure is a structure wherein each data element can connect to more than two adjacent data elements.

Examples of nonlinear data structure include trees and graphs. An AVL tree is a type of binary search tree that is always in a state of partially balanced. The balance is measured as a difference between the heights of the subtrees from the root. This self-balancing tree was known to be the first data structure to be designed as such. Doubly linked lists are a special type of linked list wherein traversal across the data elements can be done in both directions.