SlideShare a Scribd company logo
1 of 21
DATA STRUCTURES
1. What Is an Object?
An object is a software bundle of related variables and methods. Software objects are
often used to model real-world objects you find in everyday life.
2. What Is a Class?
A class is a blueprint or prototype that defines the variables and the methods common to
all objects of a certain kind.
3. What Is Inheritance?
A class inherits state and behavior from its super class. Inheritance provides a powerful
and natural mechanism for organizing and structuring software programs.
4. What Is an Interface?
An interface is a contract in the form of a collection of method and constant declarations.
When a class implements an interface, it promises to implement all of the methods
declared in that interface
5. List out the areas in which data structures are applied extensively?
The name of areas is:
 Compiler Design,
 Operating System,
 Database Management System,
 Statistical analysis package,
 Numerical Analysis,
 Graphics,
 Artificial Intelligence,
 Simulation
6. What are the major data structures used in the following areas: RDBMS, Network
data model & Hierarchical data model?
The major data structures used are as follows:
 RDBMS - Array (i.e. Array of structures)
 Network data model - Graph
Hierarchical data model – Trees
7. If you are using C language to implement the heterogeneous linked list, 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
8. What is abstract data type?
The data structure can only be accessed with defined operations. This set of operations is
called interface and is exported by the entity. An entity with the properties just described
is called an abstract data type (ADT).
9. What are the charcterstic of ADT?
An abstract data type (ADT) is characterized by the following properties:
1. It exports a type.
2. It exports a set of operations. This set is called interface.
3. Operations of the interface are the one and only access mechanism to the type's
data structure.
4. Axioms and preconditions define the application domain of the type.
10. What is encapsulation?
The principle of hiding the used data structure and to only provide a well-defined
interface is known as encapsulation.
11. Define data structure?
A data structure is a group of data elements grouped together under one name.
These data elements, known as members, can have different types and different
lengths
12. What are linear and non-linear data structures?
Linear data structures: Link list (traversal is linear in nature)
Nonlinear: graphs, trees (traversal of nodes is nonlinear in nature
13. What are the different Abstract Data Type Groups?
Memory, Abstract Data Types, and Addresses
A) Integer, Floating-Type, Character & Boolean are the four different data type
groups
Explanation: You determine the amount of memory to reserve by determining
the appropriate abstract data type group to use and then deciding which abstract
data type within the group is right for the data. The different abstract data type
groups are Integer, Floating-Type, Character & Boolean
14. Why do we Use a Multidimensional 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
15. How do you assign an address to an element of a pointer array?
You assign a memory address to an element of a pointer array by using the
address operator, which is the ampersand (&), in an assignment statement such as
ptStudents[0] = &marks[2];
16. What is a linked list?
A linked list is a data structure consisting of elements called nodes. Each node
points to the next and the previous node, thereby linking nodes together to form a
linked list
17. How can a node be inserted in the middle of a linked list?
Four operations are required:
1. prev of new node has to point to current node
2. next of new node has to point to next node
3. prev of the next node has to point to the new node
4. next of current node has to point to the new node
18. How does a stack-linked list differ from a linked list?
A stack-linked list accesses data last in, first out; a linked list accesses data first
in, first out
19. How can you search for data in a linked list?
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 sequential.
20. Define primary data structures
Primary data structures are the basic data structures that directly operate upon the
machine instructions. All the basic constants (i.e integers, floating point numbers
character constants, string constants) and pointers are considered as primary data
structures.
21. Define static data structures
A data structures formed when the number of data items is known in advance is
referred as static data structure or fixed size data structure.
22. List some of the static data structures
Some of the static data structures in C refer to arrays, pointers, structures
23. 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.
24. List some of the dynamic data structures in C.
Some of the dynamic data structures in C refer to linked lists, stacks, queues,
trees, etc.
25. Define linear data structure
Linear data structure is data structure having a linear relation ship between its
adjacent elements. Linked lists are examples of linear data structure.
26. Define non-linear data structure.
Non-linear data structures are data structures that don’t have a linear relationship
between its adjacent elements but have a hierarchical relationship between the
elements. Trees and graphs are examples of nonlinear data structures.
27. State the different types of linked lists.
The different types of linked list includes, single linked list, double linked list and
circular linked list.
28. State the different types of circular linked list.
The different types of circular linked list include circular singly linked list and
circular linked list.
29. List the basic operations carried out in a linked list.
The basic operations carried out in a linked list include.
 Creation of list.
 Insertion of a node
 Deletion of a node
 Modification of a node
 Traversal of the list
30. List the other operations carried out in a linked list
The other operations carried out in a linked list includes
 Searching an element in a list
 Finding the predecessor element of a node
 Finding the successor element of a node
 Appending a linked list to another existing list
 Splitting a linked list in to two lists
 Arranging a linked list in ascending or descending order
31. List out the advantages in using a linked list
The advantages in using a linked list are
 It is not necessary to specify the number if elements in a linked list during
its declaration
 Linked list can grow and shrink in size del=pending 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.
32. List out the disadvantages in using a linked list
The advantages in using a linked list
 Searching a particular element in list is difficult and time consuming
 A linked list will use more storage space than an array to store the same
number of elements.
33. List out the application of a linked list
Some of the important applications of linked lists are manipulation of
polynomials, stacks and queues.
34. State the difference between arrays and linked list.
Arrays Linked list
 Size of any arrays is fixed. Size of a list is variable
 It is necessary to specify the It is not necessary to
Number of elements during specify the in an array declaration.
number of elements in declaration.
 It occupies less memory than It occupies more memory linked list for the
same memory
number of elements.
35. Mention some of the application of linked list
Some of the applications of linked list are,
 Stacks
 Queues
 Polynomial manipulation

36. Define a stack
Stack is an ordered collection of elements in which insertions and deletions are
restricted to one end. The end from which elements are added and /or removed is
referred to as top of the stack. Stacks are also referred as “piles” and push-down
lists”.
37. List out the basic operations that can be performed on a stack.
The basic operations that can be performed on a stack are
 Push
 Pop
 View stack contents
38. State the advantages of using infix notations
 It is the mathematical way of representing the expression
 It’s easier to see visually which operation is done from first to LAST
39. State the different ways of representing expressions
 infix notation
 post fix notation
 prefix notation
40. State the advantages of using postfix notations
 You need not worry about the rules of precedence
 You need to worry about the rules for right to left associatively
 You need not parenthesis to override the above rules
41. State the rules to be followed during infix to postfix conversions
 Fully parenthesize the expression starting from left to right
 Move the operators having higher precedence are first parenthesized
 The part of the expression, which has been converted into post fix, is to be
treated as single operand.
 Once the expression is converted into postfix form ,remove all parenthesis
42. State the rules to be followed during infix to postfix conversions
 Fully parenthesize the expression starting from left to right
 Move the operators one by one to their left,such that each operator replaces
their corresponding left parenthesis
 The part of the expression, which has been converted into pre fix is to be
treated as single operand.
 Once the expression is converted into prefix form, remove all parentheses.
43. Mention the advantages of representing stacks using linked list than arrays
 It is not necessary to specify the number of elements to be stored in a stack
during its declaration
 Insertions and deletions can be handled easily and efficiently
 Linked list representation of stacks can grow & shrink in size without
wasting the 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
 Multiple stacks can be represented efficiently using a chain for each stack.
44. Define a queue
Queue s an ordered collection of elements in which insertions and deletions are
restricted to one end. The end from which elements are added/or removed is
referred to as the rear end, and the end from which deletions are made is referred
to as the front end
45. Define priority queue
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, but are arranged
in order of their priority. The elements with the same priority are given equal
importance and processed accordingly.
46. State the difference between queues and linked list
The difference between queues and linked lists is that insertion and deletions may
occur anywhere in linked list, but in queues insertions can be made only in the
rear end and deletions can be made only in the front end.
47. define a dequeue
Dequeue 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 only. The output restricted deque allows
deletion at one end (it can be front or rear).only
48. Minimum number of queues needed to implement the priority queue?
Two. One queue is used for actual storing of data and another for storing priorities
49. Define tree
A tree is a non linear, two dimensional data structure which represents
hierarchical relationship between individual data items.
50. Define a path in a tree
A path in a tree is a sequence if distict nodes in which successive nodes are
connected by edges in the tree.
51. Define terminal nodes in a tree
A node that has no children is called as a terminal node.It is also referred as a leaf
node.These nodes have degree has zero.
52. Define non-terminal nodes in a tree
All intermediate nodes that traverse the given tree from its root node to the
terminal nodes are referred as non terminal nodes.
53. Define a binary tree
A binary tree is tree, which has nodes either empty or not more than two child
nodes each of which may be a leaf node.
54. 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.
55. 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.
56. Define a right skewed binary tree
A right skewed binary tree is a tree, which has only right child nodes
57. State the properties of a binary tree.
 The maximum number of nodes on level n of the binary tree is 2n-1 where n>=1
 The maximum number of nodes in a binary tree of height n is 2n-1 where n>=1
 For any non empty tree nl =nd+1 where nl is the number of leaf nodes and nd is the
number of nodes of degree 2.
58. What are the different ways of representing a binary tree?
 Linear representation using arrays
 Linked representation using pointers
59. What is meant by binary tree traversal?
Traversing a binary tree means moving through all the nodes in the binary tree
visiting each node in the tree only once.
60. What are the difference binary tree traversal techniques?
 Preorder
 Inorder
 Postorder
61. What are the tasks performed while traversing a binary tree?
 Visiting a node
 Traverse the left sub tree
 Traverse the right subtree
62. What are the tasks performed during preorder traversal?
 Process the root node.
 Traverse the left subtree
 Traverse the right subtree
63. What are the tasks performed during inorder traversal?
 Traverse the left subtree
 Process the root node.
 Traverse the right subtree
64. What are the tasks performed during postorder traversal?
 Traverse the left subtree
 Traverse the right subtree
 Process the root node.
65. State the merits and demerits of linear representation of binary trees
The merits:
 Storage method is easy and can be easily implemented in arrays
 When the location of a parent /child node is known other one can be
determined easily.
 It requires static memory allocation so it is easily implemented in all
programming language
The demerits:
 Insertions and deletions in a node, taker an excessive amount of
processing time due to data movement up and down the array.
66. State the merits and demerits of linked representation of a binary tree
The merits:
 Insertions and deletions in a node, involves no data movement except the
re arrangement of pointers, hence less processing time.
The demerits:
 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 subtrees.
 It requires dynamic memory allocation, which is not possible in some
programming languages.
67. Define a binary search tree.
A binary search tree is a special binary tree which s either empty or I it is empty it
should satisfy the following characteristics.
 Every node has a value and no two nodes should have the same value.
 The values in any left subtree are less than the value of its parent node.
 The values in any right subtree are greater than the values of its parent
node.
 The left and right subtrees of each nod are again binary search trees.
68. what do you mean by general trees
General tree is a tree with nodes having any number of children
69. Define graph
A graph is a non-linear data structure that represents less relationship between its
adjacent elements. There is no hierarchical relationship between the adjacent
elements in case of graphs.
70. Define directed graph.
If an edge between any two nodes in a graph is directionally oriented, a graph is
called as directed .it is also referred as digraph.
71. Define undirected graph.
If an edge between any two nodes in a graph is not directionally oriented, a graph
is called as undirected .it is also referred as unqualified graph.
72. Define path in a graph
A path in a graph is defined as a sequence of distinct vertices each adjacent to the
next except possibly the first vertex and last vertex is different.
73. Define a cycle in a graph
A cycle is a path containing atleast three vertices such that the starting and the
ending vertices are the same.
74. Define a strongly connected graph
A graph is said to be a strongly connected graph, if for every pair of distinct
vertices there is a directed path from every vertex to every other vertex. It is also
referred as a complete graph.
75. Define a weakly connected graph.
A directed graph is said to be a weakly connected graph if any vertex doesn’t
have a directed path to any other vertices.
76. Define a weighted graph.
A graph is said to be a weighted graph if every edge in the graph is assigned some
weight or value. The weight of an edge is a positive value that may be
representing the distance between the vertices or the weights of the edges along
the path.
77. Define adjacency matrix
Adjacency matrix is a representation used to represent a graph with zeros and
ones. A graph containing n vertices can be represented by a matrix with n rows
and n columns. The matrix is formed by storing 1 n its ith and jth column of the
matrix, if there exists an edge between ith and jth vertex of the graph and 0 if
there is no edge between ith and jth vertex of the graph . Adjacency matrix is also
referred as incidence matrix.
78. What is meant by traversing a graph? State the different ways of traversing a
graph.
Traversing a graph means visiting all the nodes in the graph. In many practical
applications, traversing a graph s important, such that each vertex is visited once
systematically by traversing through minimum number of paths. The two
important graph traversal methods are
 Depth first traversal or depth first search (DFS)
 Breadth first traversal or breadth first search (BFS)
79. What are the notations used in Evaluation of Arithmetic Expressions using prefix
and postfix forms?
Polish and Reverse Polish notations
80. Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and
Postfix notations.
Prefix Notation: ^ - * +ABC - DE + FG
Postfix Notation: AB + C * DE - - FG + ^
81. List out few of the Application of tree data-structure?
The list is as follows:
 The manipulation of Arithmetic expression,
 Symbol Table construction,
 Syntax analysis.
82. List out few of the applications that make use of Multilinked Structures?
The applications are listed below:
 Sparse matrix,
 Index generation
83. In tree construction which is the suitable efficient data structure?
Linked list is the efficient data structure.
84. What is the type of the algorithm used in solving the 8 Queens problem?
Backtracking
85. In an AVL tree, at what condition the balancing is to be done?
If the 'pivotal value' (or the 'Height factor') is greater than 1 or less than -1.
86. Traverse the given tree using Inorder, Preorder and Postorder traversals.
 Inorder : D H B E A F C I G J
 Preorder: A B D H E C F G I J
 Postorder: H D E B F I J G C A
87. There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could
have formed a full binary tree?
Answer is 15.
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 15.
88. In the given binary tree, using array you can store the node 4 at which location?
At location 6
1 2 3 - - 4 - - 5
Root LC1 RC1 LC2 RC2 LC3 RC3 LC4 RC4
where LCn means Left Child of node n and RCn means Right Child of node n
89. For the given graph, draw the DFS and BFS?
Answer:
 BFS: A X G H P E M Y J
 DFS: A X H P E Y M J G
90. In RDBMS, what is the efficient data structure used in the internal storage
representation?
B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes
searching easier. This corresponds to the records that shall be stored in leaf nodes.
91. Draw the B-tree of order 3 created by inserting the following data arriving in
sequence - 92 24 6 7 11 8 22 4 5 16 19 20 78
92. 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 minimize
93. Does the minimum spanning tree of a graph give the shortest distance between any 2
specified nodes?
No. Minimal spanning tree assures that the total weight of the tree is kept at its minimum.
But it doesn't mean that the distance between any two nodes involved in the minimum-
spanning tree is minimum.
94. Convert the given graph with weighted edges to minimal spanning tree.
the equivalent minimal spanning tree is:
95. Whether Linked List is linear or Non-linear data structure?
According to Access strategies Linked list is a linear one.
According to Storage Linked List is a Non-linear one
Draw a binary Tree for the expression : A * B - (C + D) * (P / Q)
96. What is a Tree?
A tree is a data structure where data is stored in nodes. Nodes are arranged in
branches where each node can expand into 0, 1, or 2 other nodes
97. What is the purpose of a left child node and a right child node?
The left child node has a key that is less than the key of its parent node. The right
child node has a key that is greater than the key of its parent node
98. What is a leaf node?
A leaf node is the last node on a branch
99. If the depth of a tree is 3 levels, then what is the Size of the Tree?
You calculate the size of a tree by using the following formula: size = 2 ^ depth If the
depth is 3 levels, then the size is 8, as shown here: 8 = 2 ^ 3
100. What is hashing?
Hashing is the technique of scrambling bits of a key into a hash number
101. Why is it necessary to hash?
Hashing assures that the format of keys is uniform and unique
102. How many null branches are there in a binary tree with 20 nodes?
21
Let us take a tree with 5 nodes (n=5)
It will have only 6 (ie, 5+1) null branches.
A binary tree with n nodes has exactly n+ 1 null node
103. Define sorting
Sorting a group or sequence of elements or data items means rearranging them in
either ascending or descending order depending upon the relationship among the
data items present in the group.
104. What are the factors to be considered while choosing a sorting technique?
 Programming time
 Running time of the sorting technique
 Number of comparisons required for sorting the list
 Main or auxiliary memory space needed for the sorting technique
105. What are the methods available in storing sequential files?
The methods available in storing sequential files are:
 Straight merging,
 Natural merging,
 Polyphase sort,
 Distribution of Initial runs.
106. What is the necessity for sorting technique?
All data processing requires accessing records efficiently and quickly. Search
techniques are most efficient only when the data items are sort according to some
specified keys. If the list/file is not sorted searching a record takes more time
when the list/file is large.
107. Mention some of sorting techniques
 Bubble sort
 Insertion sort
 Selection sort
 Shell sort
 Merge sort
 Radix sort
 Quick sort
 Heap sort
108. When sorting method is is said to be stable?
A sorting method is said to be stable when it has minimum number of swaps i.e if
the two data item of matching value are guaranteed not to be rearranged with
respect to each other when the algorithm progresses.
109. List out some of the stable and unstable sorting technique
Stable techniques are:
 Bubble sort
 Insertion sort
 Selection sort
 Merge sort
Unstable techniques are:
 Shell sort
 Radix sort
 Quick sort
 Heap sort
110. Why is the bubble sort called by that name?
The bubble sort derives its name from the fact while sorting the data, the smallest
data item bubbles to the initial position of the partially sorted list.
111. Why is the bubble sort also called as sinking sort?
Bubble sort also referred as sinking sort derives its name from the fact that while
sorting the data the largest data item sinks to the final position of the list.
112. Why is the insertion sort called by that name?
The insertion sort derives its name from the fact that while sorting the data each
data item is inserted in its correct position among the initially placed data items.
113. Why is the insertion sort most efficient when the original data are almost in
sorted order?
Data exchange in insertion sort is minimal when the list to be sorted is in almost
sorted order
114. Mention the limitation of insertion sort.
Insertion sort has the limitation that it compares only the consecutive elements
and interchanges the elements by only one space. The smaller elements that are
far away require many passes through the sort to properly place them in its correct
position.
115. Why is the selection sort called by that name?
The selection sort devices its name from the fact while sorting the data, it selects
the smallest element in the list and swaps with the first element in the list. Then
the next smallest element is selected and swapped with the second element in the
list and so on until all the elements have been sorted in ascending order.
116. How sorting is performed in shell sort?
The shell sort devices the list into smaller sub lists and then sorts the sub lists
separately using the insertion sort by comparing elements that are at a specific
distance from each other and swaps the, if necessary.
117. Why the shell sort is is also called as diminishing increment sort?
Shell sort is also called as diminishing increment sort because the number of
elements compared in a list continuously decreases.
118. State the advantage of shell sort over insertion sort
The shell sort overcome the limitation of insertion sort and gains speed ,by
comparing elements that are at a specific distance from each other and
interchanges them if necessary hence the sorting time is reduced in case of shell
sort.
119. How sorting is performed in merge sort?
The merge sort algorithm chops the list in two. If the list has even length, split the
list into two equal sub lists. If the list has odd length, divide the list into two by
making the first sub list one entry greater than the second sub list. Then split both
the sub lists into two and go on until each of the sub lists are of size one. Finally
start merging the individual sub lists to obtain a sorted list.
120. Why is the radix sort called by that name?
The radix sort derives its name from the fact that while sorting the data ,it
considers the radix of elements from lower order byte to higher order byte and
sorts the data items in the list.
121. Why the radix sort is also called as bucket sort?
Radix sort is also referred as the bucket sort because the elements to be stored are
compared digit by digit and the values are stored into buckets where the index is
given by the position of the digit being sorted. Once all digit positions have been
examined the list must be sorted.
122. How sorting is performed in quick?
Quick sort divides the initial unsorted list into two parts, such that every element
in the first list is less than all the elements present in the second list. The
procedure is then repeated recursively for both the parts up to relatively short
sequence which can be sorted until the sequences reduces to length one.
123. What is median-of-three portioning method?
The median of three portioning method is employed in quick sort into find the
pivot value. This is done by randomly choosing three elements in the list and
finding the median of the elements gives the pivot value.
124. Define heap
A heap is defined to be a complete binary tree with the property that the value of
each node is at least as large the value of its child nodes, if they exist. The root
node of the heap has the largest value in the tree.
125. Why is the heap sort called by that name?
The heap sort derives its name from the fact that while sorting the data ,the first
step is to store the data in the form of a heap.
126. What is a heap in heap sort?
Heap in heap sort is nothing but the binary tree in which the elements to be sorted
are stored.
127. What do you mean by max heap?
A max heap referred as descending heap of size n is defined as a complete binary
tree of n nodes such that the content of each node is less than to the contents of its
parent node.
128. What do you mean by min heap?
A min heap referred as ascending heap of size n is defined as a complete binary
tree of n nodes such that the content of each node is greater than to the contents of
its parent node.
129. What do you mean by ternary heap?
A ternary heap of size n is defined as a complete binary tree of n nodes in which
the contents of each node is greater than or equal to the contents of all its
descendants.
130. How sorting is performed in heap sort?
A heap in a heap sort is nothing but the binary tree in which the elements to be
sorted are stored. Then a loop is used to remove each element of the heap. When
an element is removed it is still part of the list and is swapped with the last item of
the heap. This process continues and each time the largest item is pushed to the
end of the heap, which is directly before the item to be discarded in the previous
iteration since the heap becomes smaller.
131. Is the heap sort is always better than the quick sort?
No, the heap sort is better than the quick sort when the array is nearly sorted
.since it begins the heap sort algorithm. But if the data is not in sorted order and
for well chosen pivots quick sort is much faster than heap sort
132. Which is the fastest sorting technique & why?
As the name indicates the quick sort technique is the fastest sorting technique.
The purpose of quick sort is to move a data item in the correct position just
enough to reach its final position in the list. This method therefore reduces
unnecessary swaps. The quick sort technique has an advantage of moving a data
item a great distance in one move to place it in its exact position.
133. Define searching
Searching is programming technique that determines whether an element or a data
item is present in the given list or not.
134. Mention some of the searching techniques.
 Linear or sequential search
 Binary search
135. What is meant by sequential search?
In sequential search ,the value to be found is searched ,from left to right one by
one until the element is found or until the end of the list is reached. This search is
also referred as linear search and it does not require that the data items in the list
to be in sorted order.
136. State the advantages of sequential search?
In sequential search, the value to be found is searched normally on unsorted data.
The logic of this search is simply straight forward. Hence the coding is simple and
easily understandable.
137. What is meant by binary search?
The binary search algorithm is one of the most efficient sorting techniques, which
requires the list to be sorted in ascending order. To search for an element in the
list, the binary search algorithm splits the list into two and locates the middle
element the first part of the list is searched else the second part of the list is
searched. This process continues until the search element is equal to the middle
element or the list consists of only one element that is not equal to the search
element.
138. What is meant by Fibonacci search?
A possible improvement in the binary search is not use the middle element at each
step, but to guess more precisely where the key being sought falls within the
current interval of interest. This improved version is called Fibonacci search.
139. Which is the fastest searching technique?
If the list is in stored order, Fibonacci search is the fastest searching techniques,
but if the list us not in sorted order, sequential search is the fastest searching
technique

More Related Content

What's hot

Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...
Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...
Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...Simplilearn
 
Object Oriented Analysis (Coad-Yourdon)
Object Oriented Analysis (Coad-Yourdon)Object Oriented Analysis (Coad-Yourdon)
Object Oriented Analysis (Coad-Yourdon)Subash Khatiwada
 
Java collections concept
Java collections conceptJava collections concept
Java collections conceptkumar gaurav
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operationsanujaggarwal49
 
5.3 mining sequential patterns
5.3 mining sequential patterns5.3 mining sequential patterns
5.3 mining sequential patternsKrish_ver2
 
Collections in Java
Collections in JavaCollections in Java
Collections in JavaKhasim Cise
 
Linear discriminant analysis
Linear discriminant analysisLinear discriminant analysis
Linear discriminant analysisBangalore
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineJason Terpko
 
Creating a database
Creating a databaseCreating a database
Creating a databaseRahul Gupta
 
Historical Evolution of RDBMS
Historical Evolution of RDBMSHistorical Evolution of RDBMS
Historical Evolution of RDBMSShailesh Pachori
 
Linear Discriminant Analysis (LDA)
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA)
Linear Discriminant Analysis (LDA)Anmol Dwivedi
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1Umar Ali
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignRiccardo Cardin
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - JavaDrishti Bhalla
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection frameworkankitgarg_er
 

What's hot (20)

Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...
Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...
Hierarchical Clustering | Hierarchical Clustering in R |Hierarchical Clusteri...
 
Object Oriented Analysis (Coad-Yourdon)
Object Oriented Analysis (Coad-Yourdon)Object Oriented Analysis (Coad-Yourdon)
Object Oriented Analysis (Coad-Yourdon)
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
 
Mongo Nosql CRUD Operations
Mongo Nosql CRUD OperationsMongo Nosql CRUD Operations
Mongo Nosql CRUD Operations
 
5.3 mining sequential patterns
5.3 mining sequential patterns5.3 mining sequential patterns
5.3 mining sequential patterns
 
Collections in Java
Collections in JavaCollections in Java
Collections in Java
 
Dbms viva questions
Dbms viva questionsDbms viva questions
Dbms viva questions
 
Linear discriminant analysis
Linear discriminant analysisLinear discriminant analysis
Linear discriminant analysis
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
Session 14 - Hive
Session 14 - HiveSession 14 - Hive
Session 14 - Hive
 
Creating a database
Creating a databaseCreating a database
Creating a database
 
Historical Evolution of RDBMS
Historical Evolution of RDBMSHistorical Evolution of RDBMS
Historical Evolution of RDBMS
 
Linear Discriminant Analysis (LDA)
Linear Discriminant Analysis (LDA)Linear Discriminant Analysis (LDA)
Linear Discriminant Analysis (LDA)
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1
 
K means Clustering Algorithm
K means Clustering AlgorithmK means Clustering Algorithm
K means Clustering Algorithm
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
SOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented DesignSOLID - Principles of Object Oriented Design
SOLID - Principles of Object Oriented Design
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
 
Collections in-csharp
Collections in-csharpCollections in-csharp
Collections in-csharp
 

Similar to DATA STRUCTURES - SHORT NOTES

2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdfSulabhPawaia
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxSaralaT3
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxsarala9
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfraji175286
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using pythonLavanyaJ28
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Tutort Academy
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEVenugopalavarma Raja
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its FundamentalsHitesh Mohapatra
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS Adams Sidibe
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Raj Naik
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxmexiuro901
 

Similar to DATA STRUCTURES - SHORT NOTES (20)

Ch1
Ch1Ch1
Ch1
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdf
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using python
 
Data structures
Data structuresData structures
Data structures
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
DSA - Copy.pptx
DSA - Copy.pptxDSA - Copy.pptx
DSA - Copy.pptx
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its Fundamentals
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
Nagaraju
NagarajuNagaraju
Nagaraju
 
Data structure
Data structureData structure
Data structure
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptx
 

More from suthi

Object Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert HarleObject Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert Harlesuthi
 
THE ROLE OF EDGE COMPUTING IN INTERNET OF THINGS
THE ROLE OF EDGE COMPUTING IN INTERNET OF THINGSTHE ROLE OF EDGE COMPUTING IN INTERNET OF THINGS
THE ROLE OF EDGE COMPUTING IN INTERNET OF THINGSsuthi
 
EDGE COMPUTING: VISION AND CHALLENGES
EDGE COMPUTING: VISION AND CHALLENGESEDGE COMPUTING: VISION AND CHALLENGES
EDGE COMPUTING: VISION AND CHALLENGESsuthi
 
Document Classification Using KNN with Fuzzy Bags of Word Representation
Document Classification Using KNN with Fuzzy Bags of Word RepresentationDocument Classification Using KNN with Fuzzy Bags of Word Representation
Document Classification Using KNN with Fuzzy Bags of Word Representationsuthi
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESsuthi
 
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESOBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESsuthi
 
PARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTES
PARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTESPARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTES
PARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTESsuthi
 
SOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTES
SOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTESSOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTES
SOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTESsuthi
 
COMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESCOMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESsuthi
 
DATA BASE MANAGEMENT SYSTEM - SHORT NOTES
DATA BASE MANAGEMENT SYSTEM - SHORT NOTESDATA BASE MANAGEMENT SYSTEM - SHORT NOTES
DATA BASE MANAGEMENT SYSTEM - SHORT NOTESsuthi
 
OPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESOPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESsuthi
 
SOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTES
SOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTESSOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTES
SOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTESsuthi
 
ALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTESALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTESsuthi
 
COMPUTER NETWORKS - SHORT NOTES
COMPUTER NETWORKS - SHORT NOTESCOMPUTER NETWORKS - SHORT NOTES
COMPUTER NETWORKS - SHORT NOTESsuthi
 
ARTIFICIAL INTELLIGENCE - SHORT NOTES
ARTIFICIAL INTELLIGENCE - SHORT NOTESARTIFICIAL INTELLIGENCE - SHORT NOTES
ARTIFICIAL INTELLIGENCE - SHORT NOTESsuthi
 
LIGHT PEAK
LIGHT PEAKLIGHT PEAK
LIGHT PEAKsuthi
 
Action Recognition using Nonnegative Action
Action Recognition using Nonnegative ActionAction Recognition using Nonnegative Action
Action Recognition using Nonnegative Actionsuthi
 
C Programming Tutorial
C Programming TutorialC Programming Tutorial
C Programming Tutorialsuthi
 
Data structure - mcqs
Data structure - mcqsData structure - mcqs
Data structure - mcqssuthi
 
Data base management systems ppt
Data base management systems pptData base management systems ppt
Data base management systems pptsuthi
 

More from suthi (20)

Object Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert HarleObject Oriented Programming -- Dr Robert Harle
Object Oriented Programming -- Dr Robert Harle
 
THE ROLE OF EDGE COMPUTING IN INTERNET OF THINGS
THE ROLE OF EDGE COMPUTING IN INTERNET OF THINGSTHE ROLE OF EDGE COMPUTING IN INTERNET OF THINGS
THE ROLE OF EDGE COMPUTING IN INTERNET OF THINGS
 
EDGE COMPUTING: VISION AND CHALLENGES
EDGE COMPUTING: VISION AND CHALLENGESEDGE COMPUTING: VISION AND CHALLENGES
EDGE COMPUTING: VISION AND CHALLENGES
 
Document Classification Using KNN with Fuzzy Bags of Word Representation
Document Classification Using KNN with Fuzzy Bags of Word RepresentationDocument Classification Using KNN with Fuzzy Bags of Word Representation
Document Classification Using KNN with Fuzzy Bags of Word Representation
 
AUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTESAUTOMATA THEORY - SHORT NOTES
AUTOMATA THEORY - SHORT NOTES
 
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTESOBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
OBJECT ORIENTED PROGRAMMING LANGUAGE - SHORT NOTES
 
PARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTES
PARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTESPARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTES
PARALLEL ARCHITECTURE AND COMPUTING - SHORT NOTES
 
SOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTES
SOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTESSOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTES
SOFTWARE QUALITY ASSURANCE AND TESTING - SHORT NOTES
 
COMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTESCOMPUTER HARDWARE - SHORT NOTES
COMPUTER HARDWARE - SHORT NOTES
 
DATA BASE MANAGEMENT SYSTEM - SHORT NOTES
DATA BASE MANAGEMENT SYSTEM - SHORT NOTESDATA BASE MANAGEMENT SYSTEM - SHORT NOTES
DATA BASE MANAGEMENT SYSTEM - SHORT NOTES
 
OPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESOPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTES
 
SOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTES
SOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTESSOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTES
SOFTWARE ENGINEERING & ARCHITECTURE - SHORT NOTES
 
ALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTESALGORITHMS - SHORT NOTES
ALGORITHMS - SHORT NOTES
 
COMPUTER NETWORKS - SHORT NOTES
COMPUTER NETWORKS - SHORT NOTESCOMPUTER NETWORKS - SHORT NOTES
COMPUTER NETWORKS - SHORT NOTES
 
ARTIFICIAL INTELLIGENCE - SHORT NOTES
ARTIFICIAL INTELLIGENCE - SHORT NOTESARTIFICIAL INTELLIGENCE - SHORT NOTES
ARTIFICIAL INTELLIGENCE - SHORT NOTES
 
LIGHT PEAK
LIGHT PEAKLIGHT PEAK
LIGHT PEAK
 
Action Recognition using Nonnegative Action
Action Recognition using Nonnegative ActionAction Recognition using Nonnegative Action
Action Recognition using Nonnegative Action
 
C Programming Tutorial
C Programming TutorialC Programming Tutorial
C Programming Tutorial
 
Data structure - mcqs
Data structure - mcqsData structure - mcqs
Data structure - mcqs
 
Data base management systems ppt
Data base management systems pptData base management systems ppt
Data base management systems ppt
 

Recently uploaded

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 

DATA STRUCTURES - SHORT NOTES

  • 1. DATA STRUCTURES 1. What Is an Object? An object is a software bundle of related variables and methods. Software objects are often used to model real-world objects you find in everyday life. 2. What Is a Class? A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind. 3. What Is Inheritance? A class inherits state and behavior from its super class. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs. 4. What Is an Interface? An interface is a contract in the form of a collection of method and constant declarations. When a class implements an interface, it promises to implement all of the methods declared in that interface 5. List out the areas in which data structures are applied extensively? The name of areas is:  Compiler Design,  Operating System,  Database Management System,  Statistical analysis package,  Numerical Analysis,  Graphics,  Artificial Intelligence,  Simulation 6. What are the major data structures used in the following areas: RDBMS, Network data model & Hierarchical data model? The major data structures used are as follows:  RDBMS - Array (i.e. Array of structures)  Network data model - Graph Hierarchical data model – Trees 7. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
  • 2. 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 8. What is abstract data type? The data structure can only be accessed with defined operations. This set of operations is called interface and is exported by the entity. An entity with the properties just described is called an abstract data type (ADT). 9. What are the charcterstic of ADT? An abstract data type (ADT) is characterized by the following properties: 1. It exports a type. 2. It exports a set of operations. This set is called interface. 3. Operations of the interface are the one and only access mechanism to the type's data structure. 4. Axioms and preconditions define the application domain of the type. 10. What is encapsulation? The principle of hiding the used data structure and to only provide a well-defined interface is known as encapsulation. 11. Define data structure? A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths 12. What are linear and non-linear data structures? Linear data structures: Link list (traversal is linear in nature) Nonlinear: graphs, trees (traversal of nodes is nonlinear in nature 13. What are the different Abstract Data Type Groups? Memory, Abstract Data Types, and Addresses A) Integer, Floating-Type, Character & Boolean are the four different data type groups Explanation: You determine the amount of memory to reserve by determining the appropriate abstract data type group to use and then deciding which abstract
  • 3. data type within the group is right for the data. The different abstract data type groups are Integer, Floating-Type, Character & Boolean 14. Why do we Use a Multidimensional 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 15. How do you assign an address to an element of a pointer array? You assign a memory address to an element of a pointer array by using the address operator, which is the ampersand (&), in an assignment statement such as ptStudents[0] = &marks[2]; 16. What is a linked list? A linked list is a data structure consisting of elements called nodes. Each node points to the next and the previous node, thereby linking nodes together to form a linked list 17. How can a node be inserted in the middle of a linked list? Four operations are required: 1. prev of new node has to point to current node 2. next of new node has to point to next node 3. prev of the next node has to point to the new node 4. next of current node has to point to the new node 18. How does a stack-linked list differ from a linked list? A stack-linked list accesses data last in, first out; a linked list accesses data first in, first out 19. How can you search for data in a linked list? 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 sequential. 20. Define primary data structures Primary data structures are the basic data structures that directly operate upon the machine instructions. All the basic constants (i.e integers, floating point numbers character constants, string constants) and pointers are considered as primary data structures.
  • 4. 21. Define static data structures A data structures formed when the number of data items is known in advance is referred as static data structure or fixed size data structure. 22. List some of the static data structures Some of the static data structures in C refer to arrays, pointers, structures 23. 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. 24. List some of the dynamic data structures in C. Some of the dynamic data structures in C refer to linked lists, stacks, queues, trees, etc. 25. Define linear data structure Linear data structure is data structure having a linear relation ship between its adjacent elements. Linked lists are examples of linear data structure. 26. Define non-linear data structure. Non-linear data structures are data structures that don’t have a linear relationship between its adjacent elements but have a hierarchical relationship between the elements. Trees and graphs are examples of nonlinear data structures. 27. State the different types of linked lists. The different types of linked list includes, single linked list, double linked list and circular linked list. 28. State the different types of circular linked list. The different types of circular linked list include circular singly linked list and circular linked list. 29. List the basic operations carried out in a linked list. The basic operations carried out in a linked list include.  Creation of list.  Insertion of a node  Deletion of a node  Modification of a node  Traversal of the list 30. List the other operations carried out in a linked list The other operations carried out in a linked list includes  Searching an element in a list  Finding the predecessor element of a node  Finding the successor element of a node
  • 5.  Appending a linked list to another existing list  Splitting a linked list in to two lists  Arranging a linked list in ascending or descending order 31. List out the advantages in using a linked list The advantages in using a linked list are  It is not necessary to specify the number if elements in a linked list during its declaration  Linked list can grow and shrink in size del=pending 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. 32. List out the disadvantages in using a linked list The advantages in using a linked list  Searching a particular element in list is difficult and time consuming  A linked list will use more storage space than an array to store the same number of elements. 33. List out the application of a linked list Some of the important applications of linked lists are manipulation of polynomials, stacks and queues. 34. State the difference between arrays and linked list. Arrays Linked list  Size of any arrays is fixed. Size of a list is variable  It is necessary to specify the It is not necessary to Number of elements during specify the in an array declaration. number of elements in declaration.  It occupies less memory than It occupies more memory linked list for the same memory number of elements. 35. Mention some of the application of linked list Some of the applications of linked list are,  Stacks  Queues
  • 6.  Polynomial manipulation  36. Define a stack Stack is an ordered collection of elements in which insertions and deletions are restricted to one end. The end from which elements are added and /or removed is referred to as top of the stack. Stacks are also referred as “piles” and push-down lists”. 37. List out the basic operations that can be performed on a stack. The basic operations that can be performed on a stack are  Push  Pop  View stack contents 38. State the advantages of using infix notations  It is the mathematical way of representing the expression  It’s easier to see visually which operation is done from first to LAST 39. State the different ways of representing expressions  infix notation  post fix notation  prefix notation 40. State the advantages of using postfix notations  You need not worry about the rules of precedence  You need to worry about the rules for right to left associatively  You need not parenthesis to override the above rules 41. State the rules to be followed during infix to postfix conversions  Fully parenthesize the expression starting from left to right  Move the operators having higher precedence are first parenthesized  The part of the expression, which has been converted into post fix, is to be treated as single operand.  Once the expression is converted into postfix form ,remove all parenthesis 42. State the rules to be followed during infix to postfix conversions  Fully parenthesize the expression starting from left to right  Move the operators one by one to their left,such that each operator replaces their corresponding left parenthesis  The part of the expression, which has been converted into pre fix is to be treated as single operand.  Once the expression is converted into prefix form, remove all parentheses. 43. Mention the advantages of representing stacks using linked list than arrays  It is not necessary to specify the number of elements to be stored in a stack during its declaration  Insertions and deletions can be handled easily and efficiently  Linked list representation of stacks can grow & shrink in size without wasting the memory space, depending upon the insertion and deletion that occurs in the list.
  • 7.  Multiple stacks can be represented efficiently using a chain for each stack  Multiple stacks can be represented efficiently using a chain for each stack. 44. Define a queue Queue s an ordered collection of elements in which insertions and deletions are restricted to one end. The end from which elements are added/or removed is referred to as the rear end, and the end from which deletions are made is referred to as the front end 45. Define priority queue 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, but are arranged in order of their priority. The elements with the same priority are given equal importance and processed accordingly. 46. State the difference between queues and linked list The difference between queues and linked lists is that insertion and deletions may occur anywhere in linked list, but in queues insertions can be made only in the rear end and deletions can be made only in the front end. 47. define a dequeue Dequeue 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 only. The output restricted deque allows deletion at one end (it can be front or rear).only 48. Minimum number of queues needed to implement the priority queue? Two. One queue is used for actual storing of data and another for storing priorities 49. Define tree A tree is a non linear, two dimensional data structure which represents hierarchical relationship between individual data items. 50. Define a path in a tree A path in a tree is a sequence if distict nodes in which successive nodes are connected by edges in the tree. 51. Define terminal nodes in a tree A node that has no children is called as a terminal node.It is also referred as a leaf node.These nodes have degree has zero. 52. Define non-terminal nodes in a tree
  • 8. All intermediate nodes that traverse the given tree from its root node to the terminal nodes are referred as non terminal nodes. 53. Define a binary tree A binary tree is tree, which has nodes either empty or not more than two child nodes each of which may be a leaf node. 54. 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. 55. 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. 56. Define a right skewed binary tree A right skewed binary tree is a tree, which has only right child nodes 57. State the properties of a binary tree.  The maximum number of nodes on level n of the binary tree is 2n-1 where n>=1  The maximum number of nodes in a binary tree of height n is 2n-1 where n>=1  For any non empty tree nl =nd+1 where nl is the number of leaf nodes and nd is the number of nodes of degree 2. 58. What are the different ways of representing a binary tree?  Linear representation using arrays  Linked representation using pointers 59. What is meant by binary tree traversal? Traversing a binary tree means moving through all the nodes in the binary tree visiting each node in the tree only once. 60. What are the difference binary tree traversal techniques?  Preorder  Inorder  Postorder 61. What are the tasks performed while traversing a binary tree?  Visiting a node  Traverse the left sub tree  Traverse the right subtree 62. What are the tasks performed during preorder traversal?  Process the root node.  Traverse the left subtree  Traverse the right subtree 63. What are the tasks performed during inorder traversal?
  • 9.  Traverse the left subtree  Process the root node.  Traverse the right subtree 64. What are the tasks performed during postorder traversal?  Traverse the left subtree  Traverse the right subtree  Process the root node. 65. State the merits and demerits of linear representation of binary trees The merits:  Storage method is easy and can be easily implemented in arrays  When the location of a parent /child node is known other one can be determined easily.  It requires static memory allocation so it is easily implemented in all programming language The demerits:  Insertions and deletions in a node, taker an excessive amount of processing time due to data movement up and down the array. 66. State the merits and demerits of linked representation of a binary tree The merits:  Insertions and deletions in a node, involves no data movement except the re arrangement of pointers, hence less processing time. The demerits:  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 subtrees.  It requires dynamic memory allocation, which is not possible in some programming languages. 67. Define a binary search tree. A binary search tree is a special binary tree which s either empty or I it is empty it should satisfy the following characteristics.  Every node has a value and no two nodes should have the same value.  The values in any left subtree are less than the value of its parent node.  The values in any right subtree are greater than the values of its parent node.  The left and right subtrees of each nod are again binary search trees. 68. what do you mean by general trees General tree is a tree with nodes having any number of children
  • 10. 69. Define graph A graph is a non-linear data structure that represents less relationship between its adjacent elements. There is no hierarchical relationship between the adjacent elements in case of graphs. 70. Define directed graph. If an edge between any two nodes in a graph is directionally oriented, a graph is called as directed .it is also referred as digraph. 71. Define undirected graph. If an edge between any two nodes in a graph is not directionally oriented, a graph is called as undirected .it is also referred as unqualified graph. 72. Define path in a graph A path in a graph is defined as a sequence of distinct vertices each adjacent to the next except possibly the first vertex and last vertex is different. 73. Define a cycle in a graph A cycle is a path containing atleast three vertices such that the starting and the ending vertices are the same. 74. Define a strongly connected graph A graph is said to be a strongly connected graph, if for every pair of distinct vertices there is a directed path from every vertex to every other vertex. It is also referred as a complete graph. 75. Define a weakly connected graph. A directed graph is said to be a weakly connected graph if any vertex doesn’t have a directed path to any other vertices. 76. Define a weighted graph. A graph is said to be a weighted graph if every edge in the graph is assigned some weight or value. The weight of an edge is a positive value that may be representing the distance between the vertices or the weights of the edges along the path. 77. Define adjacency matrix Adjacency matrix is a representation used to represent a graph with zeros and ones. A graph containing n vertices can be represented by a matrix with n rows and n columns. The matrix is formed by storing 1 n its ith and jth column of the matrix, if there exists an edge between ith and jth vertex of the graph and 0 if there is no edge between ith and jth vertex of the graph . Adjacency matrix is also referred as incidence matrix.
  • 11. 78. What is meant by traversing a graph? State the different ways of traversing a graph. Traversing a graph means visiting all the nodes in the graph. In many practical applications, traversing a graph s important, such that each vertex is visited once systematically by traversing through minimum number of paths. The two important graph traversal methods are  Depth first traversal or depth first search (DFS)  Breadth first traversal or breadth first search (BFS) 79. What are the notations used in Evaluation of Arithmetic Expressions using prefix and postfix forms? Polish and Reverse Polish notations 80. Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent Prefix and Postfix notations. Prefix Notation: ^ - * +ABC - DE + FG Postfix Notation: AB + C * DE - - FG + ^ 81. List out few of the Application of tree data-structure? The list is as follows:  The manipulation of Arithmetic expression,  Symbol Table construction,  Syntax analysis. 82. List out few of the applications that make use of Multilinked Structures? The applications are listed below:  Sparse matrix,  Index generation 83. In tree construction which is the suitable efficient data structure? Linked list is the efficient data structure. 84. What is the type of the algorithm used in solving the 8 Queens problem? Backtracking
  • 12. 85. In an AVL tree, at what condition the balancing is to be done? If the 'pivotal value' (or the 'Height factor') is greater than 1 or less than -1. 86. Traverse the given tree using Inorder, Preorder and Postorder traversals.  Inorder : D H B E A F C I G J  Preorder: A B D H E C F G I J  Postorder: H D E B F I J G C A 87. There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have formed a full binary tree? Answer is 15. 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 15. 88. In the given binary tree, using array you can store the node 4 at which location?
  • 13. At location 6 1 2 3 - - 4 - - 5 Root LC1 RC1 LC2 RC2 LC3 RC3 LC4 RC4 where LCn means Left Child of node n and RCn means Right Child of node n 89. For the given graph, draw the DFS and BFS? Answer:  BFS: A X G H P E M Y J  DFS: A X H P E Y M J G 90. In RDBMS, what is the efficient data structure used in the internal storage representation? B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes.
  • 14. 91. Draw the B-tree of order 3 created by inserting the following data arriving in sequence - 92 24 6 7 11 8 22 4 5 16 19 20 78 92. 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 minimize 93. Does the minimum spanning tree of a graph give the shortest distance between any 2 specified nodes? No. Minimal spanning tree assures that the total weight of the tree is kept at its minimum. But it doesn't mean that the distance between any two nodes involved in the minimum- spanning tree is minimum. 94. Convert the given graph with weighted edges to minimal spanning tree. the equivalent minimal spanning tree is:
  • 15. 95. Whether Linked List is linear or Non-linear data structure? According to Access strategies Linked list is a linear one. According to Storage Linked List is a Non-linear one Draw a binary Tree for the expression : A * B - (C + D) * (P / Q) 96. What is a Tree? A tree is a data structure where data is stored in nodes. Nodes are arranged in branches where each node can expand into 0, 1, or 2 other nodes 97. What is the purpose of a left child node and a right child node? The left child node has a key that is less than the key of its parent node. The right child node has a key that is greater than the key of its parent node 98. What is a leaf node? A leaf node is the last node on a branch 99. If the depth of a tree is 3 levels, then what is the Size of the Tree? You calculate the size of a tree by using the following formula: size = 2 ^ depth If the depth is 3 levels, then the size is 8, as shown here: 8 = 2 ^ 3 100. What is hashing? Hashing is the technique of scrambling bits of a key into a hash number 101. Why is it necessary to hash? Hashing assures that the format of keys is uniform and unique 102. How many null branches are there in a binary tree with 20 nodes?
  • 16. 21 Let us take a tree with 5 nodes (n=5) It will have only 6 (ie, 5+1) null branches. A binary tree with n nodes has exactly n+ 1 null node 103. Define sorting Sorting a group or sequence of elements or data items means rearranging them in either ascending or descending order depending upon the relationship among the data items present in the group. 104. What are the factors to be considered while choosing a sorting technique?  Programming time  Running time of the sorting technique  Number of comparisons required for sorting the list  Main or auxiliary memory space needed for the sorting technique 105. What are the methods available in storing sequential files? The methods available in storing sequential files are:  Straight merging,  Natural merging,  Polyphase sort,  Distribution of Initial runs. 106. What is the necessity for sorting technique? All data processing requires accessing records efficiently and quickly. Search techniques are most efficient only when the data items are sort according to some specified keys. If the list/file is not sorted searching a record takes more time when the list/file is large. 107. Mention some of sorting techniques  Bubble sort  Insertion sort
  • 17.  Selection sort  Shell sort  Merge sort  Radix sort  Quick sort  Heap sort 108. When sorting method is is said to be stable? A sorting method is said to be stable when it has minimum number of swaps i.e if the two data item of matching value are guaranteed not to be rearranged with respect to each other when the algorithm progresses. 109. List out some of the stable and unstable sorting technique Stable techniques are:  Bubble sort  Insertion sort  Selection sort  Merge sort Unstable techniques are:  Shell sort  Radix sort  Quick sort  Heap sort 110. Why is the bubble sort called by that name? The bubble sort derives its name from the fact while sorting the data, the smallest data item bubbles to the initial position of the partially sorted list. 111. Why is the bubble sort also called as sinking sort? Bubble sort also referred as sinking sort derives its name from the fact that while sorting the data the largest data item sinks to the final position of the list. 112. Why is the insertion sort called by that name? The insertion sort derives its name from the fact that while sorting the data each data item is inserted in its correct position among the initially placed data items. 113. Why is the insertion sort most efficient when the original data are almost in sorted order? Data exchange in insertion sort is minimal when the list to be sorted is in almost sorted order 114. Mention the limitation of insertion sort. Insertion sort has the limitation that it compares only the consecutive elements and interchanges the elements by only one space. The smaller elements that are
  • 18. far away require many passes through the sort to properly place them in its correct position. 115. Why is the selection sort called by that name? The selection sort devices its name from the fact while sorting the data, it selects the smallest element in the list and swaps with the first element in the list. Then the next smallest element is selected and swapped with the second element in the list and so on until all the elements have been sorted in ascending order. 116. How sorting is performed in shell sort? The shell sort devices the list into smaller sub lists and then sorts the sub lists separately using the insertion sort by comparing elements that are at a specific distance from each other and swaps the, if necessary. 117. Why the shell sort is is also called as diminishing increment sort? Shell sort is also called as diminishing increment sort because the number of elements compared in a list continuously decreases. 118. State the advantage of shell sort over insertion sort The shell sort overcome the limitation of insertion sort and gains speed ,by comparing elements that are at a specific distance from each other and interchanges them if necessary hence the sorting time is reduced in case of shell sort. 119. How sorting is performed in merge sort? The merge sort algorithm chops the list in two. If the list has even length, split the list into two equal sub lists. If the list has odd length, divide the list into two by making the first sub list one entry greater than the second sub list. Then split both the sub lists into two and go on until each of the sub lists are of size one. Finally start merging the individual sub lists to obtain a sorted list. 120. Why is the radix sort called by that name? The radix sort derives its name from the fact that while sorting the data ,it considers the radix of elements from lower order byte to higher order byte and sorts the data items in the list. 121. Why the radix sort is also called as bucket sort? Radix sort is also referred as the bucket sort because the elements to be stored are compared digit by digit and the values are stored into buckets where the index is given by the position of the digit being sorted. Once all digit positions have been examined the list must be sorted. 122. How sorting is performed in quick?
  • 19. Quick sort divides the initial unsorted list into two parts, such that every element in the first list is less than all the elements present in the second list. The procedure is then repeated recursively for both the parts up to relatively short sequence which can be sorted until the sequences reduces to length one. 123. What is median-of-three portioning method? The median of three portioning method is employed in quick sort into find the pivot value. This is done by randomly choosing three elements in the list and finding the median of the elements gives the pivot value. 124. Define heap A heap is defined to be a complete binary tree with the property that the value of each node is at least as large the value of its child nodes, if they exist. The root node of the heap has the largest value in the tree. 125. Why is the heap sort called by that name? The heap sort derives its name from the fact that while sorting the data ,the first step is to store the data in the form of a heap. 126. What is a heap in heap sort? Heap in heap sort is nothing but the binary tree in which the elements to be sorted are stored. 127. What do you mean by max heap? A max heap referred as descending heap of size n is defined as a complete binary tree of n nodes such that the content of each node is less than to the contents of its parent node. 128. What do you mean by min heap? A min heap referred as ascending heap of size n is defined as a complete binary tree of n nodes such that the content of each node is greater than to the contents of its parent node. 129. What do you mean by ternary heap? A ternary heap of size n is defined as a complete binary tree of n nodes in which the contents of each node is greater than or equal to the contents of all its descendants. 130. How sorting is performed in heap sort? A heap in a heap sort is nothing but the binary tree in which the elements to be sorted are stored. Then a loop is used to remove each element of the heap. When an element is removed it is still part of the list and is swapped with the last item of the heap. This process continues and each time the largest item is pushed to the
  • 20. end of the heap, which is directly before the item to be discarded in the previous iteration since the heap becomes smaller. 131. Is the heap sort is always better than the quick sort? No, the heap sort is better than the quick sort when the array is nearly sorted .since it begins the heap sort algorithm. But if the data is not in sorted order and for well chosen pivots quick sort is much faster than heap sort 132. Which is the fastest sorting technique & why? As the name indicates the quick sort technique is the fastest sorting technique. The purpose of quick sort is to move a data item in the correct position just enough to reach its final position in the list. This method therefore reduces unnecessary swaps. The quick sort technique has an advantage of moving a data item a great distance in one move to place it in its exact position. 133. Define searching Searching is programming technique that determines whether an element or a data item is present in the given list or not. 134. Mention some of the searching techniques.  Linear or sequential search  Binary search 135. What is meant by sequential search? In sequential search ,the value to be found is searched ,from left to right one by one until the element is found or until the end of the list is reached. This search is also referred as linear search and it does not require that the data items in the list to be in sorted order. 136. State the advantages of sequential search? In sequential search, the value to be found is searched normally on unsorted data. The logic of this search is simply straight forward. Hence the coding is simple and easily understandable. 137. What is meant by binary search? The binary search algorithm is one of the most efficient sorting techniques, which requires the list to be sorted in ascending order. To search for an element in the list, the binary search algorithm splits the list into two and locates the middle element the first part of the list is searched else the second part of the list is searched. This process continues until the search element is equal to the middle element or the list consists of only one element that is not equal to the search element.
  • 21. 138. What is meant by Fibonacci search? A possible improvement in the binary search is not use the middle element at each step, but to guess more precisely where the key being sought falls within the current interval of interest. This improved version is called Fibonacci search. 139. Which is the fastest searching technique? If the list is in stored order, Fibonacci search is the fastest searching techniques, but if the list us not in sorted order, sequential search is the fastest searching technique