Data Structure
Data Structure
Data Structure
#Define Directed graph. === In a directed graph each edge is represented by a directed pair (v1, v2), v1 is
the tail and v2 is head of the edge i.e. the pairs (v1, v2) and (v2, v1) are different edges. In other words the
edges have direction in directed graph. Directed graph is also called as Digraph.
#Define Strict binary tree. === If every non-leaf node in a binary tree has nonempty left and right subtrees,
the tree is termed a strictly binary tree. Or, to put it another way, all of the nodes in a strictly binary tree
are of degree zero or two, never degree one. A strictly binary tree with N leaves always contains 2N - 1
nodes.ee
#Define Cyclic graph. === A cyclic graph is a graph containing at least one graph cycle. A graph that is not
cyclic is said to be acyclic. A cyclic graph possessing exactly one (undirected, simple) cycle is called a
unicyclic graph. Cyclic graphs are not trees.
#Convert the following expression into postfix. 1)A/B $ CD * E – A * C=== ans = AB/ $CD * E –A * C
(2)(A + B * C-D)/ E $ F . ===ans=A+ B * CD- /E $F
#Define an Algorithm. Explain different characteristics of an algorithm. === An algorithm is a step-by-step
procedure that defines a set of instructions that must be carried out in a specific order to produce the
desired result. Algorithms are generally developed independently of underlying languages, which means
that an algorithm can be implemented in more than one programming language.
#List out different types of data structure. Ans=Linear data structures= In linear data structures, the
elements are arranged in sequence one after the other. Since elements are arranged in particular order,
they are easy to implement. Linear=Array, linked list, stack, queue. Non-Linear data structures= Unlike
linear data structures, elements in non-linear data structures are not in any sequence. Instead they are
arranged in a hierarchical manner where one element will be connected to one or more elements. Non-
linear=trees, graph
#What is Self Referential structure? Ans= A self referential data structure is essentially a structure
definition which includes at least one member that is a pointer to the structure of its own kind. Such self
referential structures are very useful in applications that involve linked data structures, such as lists and
trees.
#Explain selection sort technique. Ans= Selection sort works by taking the smallest element in an unsorted
array and bringing it to the front. You'll go through each item (from left to right) until you find the smallest
one. The first item in the array is now sorted, while the rest of the array is unsorted.
#What is sorting? State tha techniques of sorting. Ans= Sorting is the processing of arranging the data in
ascending and descending order. There are several types of sorting in data structures namely – bubble
sort, insertion sort, selection sort, bucket sort, heap sort, quick sort, radix sort etc.
#Explain linear searching technique in detail. Ans= A linear search is the simplest approach employed to
search for an element in a data set. It examines each element until it finds a match, starting at the
beginning of the data set, until the end. The search is finished and terminated once the target element is
located.
#Describe different types of linked list. Ans= In a singly linked circular linked list, each node has a pointer
that points to the next node in the list. The last node in the list points back to the first node. In a doubly
linked circular linked list, each node has pointers that point to both the next node and the previous node
#Priority queue== Priority Queue is an abstract data type that is similar to a queue, and every element has
some priority value associated with it.
#What is mean by degree of node? Ans= The degree of a node is the number of connections that it has to
other nodes in the network. In a social network if you have 100 friends then the node that represents you
has a degree of 100. Path length is simply the distance between two nodes, measured as the number of
edges between them.
#Define Balance Factor= DEFINITION: The balance factor of a binary tree is the difference in heights of its
two subtrees (hR - hL). The balance factor (bf) of a height balanced binary tree may take on one of the
values -1, 0, +1.
#Define Leaf Node= Leaf − The node which does not have any child node is called the leaf node. Subtree −
Subtree represents the descendants of a node. Visiting − Visiting refers to checking the value of a node
when control is on the node.
#What are tha various application of graph? Ans= Some of the most popular applications are: Helps to
define the flow of computation of software programs. Used in Google maps for building transportation
systems. In google maps, the intersection of two or more roads represents the node while the road
connecting two nodes represents an edge.
#write difference between stack and queue. Ans= stack = 1. It follows the LIFO (Last In First Out) order to
store the elements, which means the element that is inserted last will come out first. 2 2. It has only one
end, known as the top, at which both insertion and deletion take place. 3.The insertion operation is known
as push and the deletion operation is known as pop. Queue= 1. It follows the FIFO (First In First Out)
order to store the elements, which means the element that is inserted first will come out first. 2. It has two
ends, known as the rear and front, which are used for insertion and deletion. The rear end is used to insert
the elements, whereas the front end is used to delete the elements from the queue. 3. The insertion
operation is known as enqueue and the deletion operation is known as dequeue. ‘
#What are tha applications of queue? Ans= Applied as waiting lists for a single shared resource like CPU,
Disk, and Printer. Applied as buffers on MP3 players and portable CD players. Applied on Operating system
to handle the interruption. Applied to add song at the end or to play from the front.
#What is queue? Explain its types in detail. Ans= A Queue is a linear structure that follows a particular
order in which the operations are performed. The order is First In First Out (FIFO). A good example of a
queue is any queue of consumers for a resource where the consumer that came first is served first.
#What is space and time complexity? ===
#What are the advantages of linked list? ===
#What is adjacency of matrix? ===
#What is complete binary tree? ===
#What is priority queue? ===
#What is the need for the header? ===
#What is height-balanced tree? ===
#What is linked list? Explain its types in detail. ===
#Explain different types of asymptotic notation in detail. ===
#Differentiate array and structure. ===
#Write a function to create & display circular singly linked list. ===
#Write a function for in order traversal of the tree. ===
#Write a function to delete first node from singly linked list. ===
#Write a function to search the element from array using binary search. ===
#Define Child node. ===
#Define path. ===
#Construct an AVL tree for given data: WED, TUE, MON, SAT, THUR, FRI. ===
#For given data, constract a binary search tree:15, 30, 20, 5, 10, 2, 7. ===
#Sort the following data by using quick sort:10, 5, 75, 62, 49, 58. ===
#Write a C-program to traverse the linked list. ===
#What is Dequeue? ===