Interview questions on data structures pdf


 

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 osakeya.info Structures are the main basics of. Data Structures Job Interview Questions. These are questions that are reported to have been asked during various job inter- views. We may not have covered.

Author:BETTE SMETAK
Language:English, Spanish, Dutch
Country:Macedonia
Genre:Health & Fitness
Pages:338
Published (Last):14.05.2016
ISBN:171-2-64278-609-5
Distribution:Free* [*Registration Required]
Uploaded by: CLINT

59397 downloads 142341 Views 33.75MB PDF Size Report


Interview Questions On Data Structures Pdf

7/17/ TOP DATA STRUCTURES and ALGORITHMS Multiple Choice Questions and Answers Engineering Interview osakeya.info Engineering. Dear readers, these Data Structures & Algorithms Interview Questions have been designed Data structure availability may vary by programming languages. Commonly Asked Data Structure Interview Questions | Set 1. What is a Data Structure? A data structure is a way of organizing the data so that the data can be .

Artificial Intelligence, Simulation 3. If you are using C language to implement the heterogeneous linked list, Explain What pointer type will you use? The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type. Minimum number of queues needed to implement the priority queue?

A queue is an ordered collection of items from which items may be deleted at one end front end and items inserted at the other end rear end. What Is A Priority Queue? The priority queue is a data structure in which the intrinsic ordering of the elements numeric or alphabetic. Here p is called dangling pointer. To avoid this it is better to set p to NULL after executing free p. Define Circular List? In linear list the next field of the last node contain a null pointer, when a next field in the last node contain a pointer back to the first node it is called circular list.

Define Double Linked List? It is a collection of data elements called nodes,. If frequent use of the file is required for the purpose of retrieving specific element, it is more efficient to sort the file. The number of comparisons depends on where the record with the argument key appears in the table.

Yes there is a set of implicit arguments that contain information necessary for the function to execute and return correctly.

Commonly Asked Data Structure Interview Questions | Set 1

Array of structures Network data model — Graph Hierarchical data model — Trees. The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.

One queue is used for actual storing of data and another for storing priorities. Recursion makes use of system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative non-recursive function.

Even when such equivalent iterative procedures are written, explicit stack is to be used. In general: There are 2n-1 nodes in a full binary tree. By the method of elimination:. Full binary trees contain odd number of nodes.

So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. So the correct answer is This corresponds to the records that shall be stored in leaf nodes. What Is A Spanning Tree? A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once.

A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized. Minimal spanning tree assures that the total weight of the tree is kept at its minimum. Difference Between Calloc And Malloc? Array of structures Network data model Graph Hierarchical data model Trees.

Definitions of member functions for the Linked List class are contained in the LinkedList. A linked list application can be organized into a header file, source file and main application file. The first file is the header file that contains the definition of the NODE structure and the LinkedList class definition.

The second file is a source code file containing the implementation of member functions of the LinkedList class. The last file is the application file that contains code that creates and uses the LinkedList class. The appendNode member function places a new node at the end of the linked list. The appendNode requires an integer representing the current data of the node.

What Is Linked List? Linked List is one of the fundamental data structures. It consists of a sequence of? A linked list is a self-referential datatype because it contains a pointer or link to another data of the same type. Linked lists permit insertion and removal of nodes at any point in the list in constant time, but do not allow random access.

Each entry in a linked list is called a node. Think of a node as an entry that has three sub entries. One sub entry contains the data, which may be one attribute or many attributes.

Another points to the previous node, and the last points to the next node. When you enter a new item on a linked list, you allocate the new node and then set the pointers to previous and next nodes.

The isEmpty member method is called within the dequeue process to determine if there is an item in the queue to be removed i. This method is called by the dequeue method before returning the front element. Enqueue is the process that places data at the back of the queue. Data stored in a queue is actually stored in an array. Two indexes, front and end will be used to identify the start and end of the queue.

When an element is removed front will be incremented by 1. In case it reaches past the last index available it will be reset to 0. Then it will be checked with end. If it is greater than end queue is empty. When an element is added end will be incremented by 1. After incrementing it will be checked with front. If they are equal queue is full.

What Is A Queue? A Queue is a sequential organization of data. A queue is a first in first out type of data structure.

An element is inserted at the last position and an element is always taken out from the first position. This method is called by Pop before retrieving and returning the top element. The pop member method removes the value from the top of a stack, which is then returned by the pop member method to the statement that calls the pop member method.

Allocating memory at runtime is called a dynamically allocating memory. In this, you dynamically allocate memory by using the new operator when declaring the array.

A multidimensional array can be useful to organize subgroups of data within an array. In addition to organizing data stored in elements of an array, a multidimensional array can store memory addresses of data in a pointer array and an array of pointers.

Multidimensional arrays are used to store information in a matrix form. One can use a 3-D array for storing height, width and length of each room on each floor of a building. Actually it depends on context.

Is Pointer A Variable? However, the contents of a pointer is a memory address of another location of memory, which is usually the memory address of another variable, element of a structure, or attribute of a class. Memory is reserved using data type in the variable declaration.

A programming language implementation has predefined sizes for its data types. A pointer declaration reserves memory for the address or the pointer variable, but not for the data that it will point to. The memory for the data pointed by a pointer has to be allocated at runtime. The memory reserved by the compiler for simple variables and for storing pointer address is allocated on the stack, while the memory allocated for pointer referenced data at runtime is allocated on the heap.

Sign of the number is the first bit of the storage allocated for that number. So you get one bit less for storing the number. For example if you are storing an 8-bit number, without sign, the range is If you decide to store sign you get 7 bits for the number plus one bit for the sign. What Is Precision? Precision refers the accuracy of the decimal portion of a value.

Precision is the number of digits allowed after the decimal point. NULL can be value for pointer type variables. VOID is a type identifier which has not size.

NULL and void are not same. Thus the item that is first entered would be the last removed. In array the items can be entered or removed in any order. Basically each member access is done using index. No strict order is to be followed here to remove a particular element.

Array may be multidiamensional or onediamensional but stack should be onediamensional. Create two pointers, each set to the start of the list. Update each as follows:. According to Access strategies Linked list is a linear one. According to Storage Linked List is a Non-linear one. What Is A Node Class? A node class is a class that, relies on the base class for services and implementation, provides a wider interface to users than its base class, relies primarily on virtual functions in its public interface depends on all its direct and indirect base class can be understood only in the context of the base class can be used as base for further derivation can be used to create objects.

A node class is a class that has added new services or functionality beyond the services inherited from its base class. A memory leak occurs when a program loses the ability to free a block of dynamically allocated memory.

Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list's members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient.

Define Data Structures? Data Structures is defined as the way of organizing all data items that consider not only the elements stored but also stores the relationship between the elements. Define Primary Data Structures?

Primary data structures are the basic data structures that directly operate upon the machine instructions. All the basic constants integers, floating-point numbers, character constants, string constants and pointers are considered as primary data structures. Define Static Data Structures? A data structure formed when the number of data items are known in advance is referred as static data structure or fixed size data structure.

Some of the static data structures in C are arrays, pointers, structures etc. Define Dynamic Data Structures? A data structure formed when the number of data items are not known in advance is known as dynamic data structure or variable size data structure.

Some of the dynamic data structures in C are linked lists, stacks, queues, trees etc. Define Linear Data Structures?

Linear data structures are data structures having a linear relationship between its adjacent elements. Define Non-linear Data Structures? Define Linked Lists? Linked list consists of a series of structures, which are not necessarily adjacent in memory. Each structure contains the element and a pointer to a structure containing its successor.

We call this the Next Pointer. The different types of linked list include singly linked list, doubly linked list and circular linked list. The basic operations carried out in a linked list include:. It is not necessary to specify the number of elements in a linked list during its declaration. Linked list can grow and shrink in size depending upon the insertion and deletion that occurs in the list. Insertions and deletions at any place in a list can be handled easily and efficiently. A linked list does not waste any memory space.

Searching a particular element in a list is difficult and time consuming. A linked list will use more storage space than an array to store the same number of elements.

Some of the important applications of linked lists are manipulation of polynomials, sparse matrices, stacks and queues. Stack is an ordered collection of elements in which insertions and deletions are restricted to one end.

Stacks are also referred as piles, push-down lists and last-in-first-out LIFO lists. The basic operations that can be performed on a stack are. The different ways of representing expressions are. It is the mathematical way of representing the expression. It is easier to see visually which operation is done from first to last. Need not worry about the rules of precedence. Need not worry about the rules for right to left associativity. Need not need parenthesis to override the above rules.

Fully parenthesize the expression starting from left to right. During parenthesizing, the operators having higher precedence are first parenthesized. Move the operators one by one to their right, such that each operator replaces their corresponding right parenthesis.

The part of the expression, which has been converted into postfix is to be treated as single operand. Once the expression is converted into postfix form, remove all parenthesis. The part of the expression, which has been converted into prefix is to be treated as single operand. Once the expression is converted into prefix form, remove all parenthesis. The difference between stacks and linked lists is that insertions and deletions may occur anywhere in a linked list, but only at the top of the stack.

It is not necessary to specify the number of elements to be stored in a stack during its declaration, since memory is allocated dynamically at run time when an element is added to the stack. Insertions and deletions can be handled easily and efficiently. Linked list representation of stacks can grow and shrink in size without wasting memory space, depending upon the insertion and deletion that occurs in the list.

Multiple stacks can be represented efficiently using a chain for each stack. Define A Queue? Queue is an ordered collection of elements in which insertions are restricted to one end called the rear end and deletions are restricted to other end called the front end.

Define A Priority Queue?

300+ TOP DATA STRUCTURES Interview Questions and Answers pdf

Priority queue is a collection of elements, each containing a key referred as the priority for that element. Elements can be inserted in any order i. The elements are deleted from the queue in the order of their priority i. The elements with the same priority are given equal importance and processed accordingly.

The difference between queues and linked lists is that insertions and deletions may occur anywhere in the linked list, but in queues insertions can be made only in the rear end and deletions can be made only in the front end. Define A Deque? Deque Double-Ended Queue is another form of a queue in which insertions and deletions are made at both the front and rear ends of the queue.

There are two variations of a deque, namely, input restricted deque and output restricted deque. The input restricted deque allows insertion at one end it can be either front or rear only. The output restricted deque allows deletion at one end it can be either front or rear only. A data structure helps you to understand the relationship of one data element with the other and organize it within the memory.

Sometimes the organization might be simple and can be very clearly visioned. A data structure helps you to analyze the data, store it and organize it in a logical and mathematical manner. A path having minimum weight between two vertices is known as shortest path, in which weight is always a positive number. If a graph is not biconnected, the vertices whose removal would disconnect the graph are known as articulation points. Define Biconnectivity?

A connected graph G is said to be biconnected, if it remains connected after removal of any one vertex and the edges that are incident upon that vertex. A connected graph is biconnected, if it has no articulation points. If w is the ancestor of v, then vw is called a back edge. If w is undiscovered at the time vw is explored, then vw is called a tree edge and v becomes the parent of w. Differentiate Bfs And Dfs?

BFS performs simultaneous explorations starting from a common point and spreading out independently. Define Graph Traversals?

Traversing a graph is an efficient way to visit each vertex and edge exactly once. A minimum spanning tree of an undirected graph G is a tree formed from graph edges that connects all the vertices of G at the lowest total cost. Breadth first search Depth first search. When a directed graph is not strongly connected but the underlying graph is connected, then the graph is said to be weakly connected.

An undirected graph is connected, if there is a path from every vertex to every other vertex. A directed graph with this property is called strongly connected. What Is An Acyclic Graph? A simple diagram which does not have any cycles is called an acyclic graph. 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? Arranging the data items in some order i. 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.

It is a abstract data structure that implements a queue for which elements can be added to front or rear and the elements can be removed from the rear or front. It is also called head-tail linked list. Avl tree is self binary tree in which balancing factor lie between the -1 to 1.

It is also known as self balancing tree. Binary tree is a tree which has maximum no. Operations includes testing null stack, finding the top element in the stack, removal of top most element and adding elements on the top of the stack.

Operations include testing null queue, finding the next element, removal of elements and inserting the elements from the queue. Insertion of elements is at the end of the queue. Deletion of elements is from the beginning of the queue.

Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point. When new data is to be inserted into the data structure but there is no available space i.

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

Get daily job alert, placement paper and GK updates every day on your email. Register Now to benefit from our unlimited fresher focussed services! Contribute Placement Papers. Free Job Alert. Sarkari Naukri. Employment News. Sarkari Results. Campus Fests. Job Results. Online Test. GATE Preparation.

Commonly Asked Data Structure Interview Questions | Set 1 - GeeksforGeeks

CAT Preparation. Bank Preparation. Current Affairs Latest January March February C Programming Interview Questions. Java Interview Questions. Civil Interview Questions. PHP Interview Questions. OS Interview Questions. Software Testing Interview Questions.

Networking Interview Questions. Data Structure Interview Questions. Net Interview Questions. Algorithms Interview Questions. Software Testing. Electrical Interview Questions. Electronics Interview Questions. Mechanical Interview Questions.

Data Structure Interview Questions updated on Apr What is data structure? One queue is used for actual storing of data and another for storing priorities. Polish and Reverse Polish notations.

List out few of the Application of tree data-structure? Backtracking 6.

TOP Related


Copyright © 2019 osakeya.info.
DMCA |Contact Us