SlideShare a Scribd company logo
1 of 10
1
Course/Year/Sem: B.Sc/ I / II
UCS18202 – Data Structures
UNIT – I -Part A
1. Define data structure?
Data structures is the branch of computer science that unleashes the knowledge
of how the data should be organized, how the flow of data should be controlled, and how
a data structure should be designed and implemented to reduce the complexity and
increase the efficiency of the algorithm.
2. What is the need of a data structure?
A data structure helps you to understand the relationship of one data element
with the other and organize it within the memory.
3. Write about asymptotic notation.
The complexity of algorithm is analyzed through asymptotic notations. The notation are
Big oh, Omega &Theta.
4. What is recursion?
A recursion routine is one whose design includes a call to itself.
5. Why Big ‘O’ notation.
Big ‘O’ notation, determine the time taken by the algorithm, and also the amount
of space required to run the algorithm.
6. Define a list.
List the term used to refer to the linear collection of data items.
7. State about Linked List.
Linked list is a linear collection of data elements, called nodes, where the linear
order is implemented by means of pointers. A linked list allocates memory for storing list
elements and connects elements together using pointers.
8. List out types of time complexity.
i. Best case time complexity.
ii. Average time complexity
iii. Worst case complexity.
9. Write about time complexity.
The time needed by an algorithm expressed as a function of the size of a
problem is called the TIME COMPLEXITY of the algorithm. The time complexity of a
program is the amount of computer time it needs to run to completion.
10. What do you mean by space complexity?
The space complexity of a program is the amount of memory it needs to run to
completion.
11. Define best case time complexity.
The best case time complexity of an algorithm is a measure of the minimum time that
the algorithm will require for an input of size “n”.
12. Define worst case time complexity.
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
Ramapuram Campus
Department of computer applications
2
The worst case time complexity of an algorithm is a measure of the maximum time that
the algorithm will require for an input of size “n”.
13. Define average case time complexity.
The average case time complexity of an algorithm is a measure of the average
time that the algorithm will require for an input of size “n”.
14. Define linear and non linear data structure.
Linear Data Structure:-
A data structure is said to be linear if its elements form a sequence or a linear
list. The linear data structures like an array, stacks, queues and linked lists organize data
in linear order.
Non Linear Structure:-
A data structure is said to be non linear if its elements form a hierarchical
classification where, data items appear at various levels.
Trees and Graphs are widely used non-linear data structures. Tree and graph structures
representhierarchical relationship between individual data elements. Graphs are nothing
but trees with certain restrictions removed.
15. List out the operations performed on data structure
 Insertion:-Insertion means adding new node into the data structures.
 Deletion:- Deletion means removing a node from the data structures.
 Traversal:- Traversing means accessing each record exactly once so that
certain items in the record may be processed.
 Searching: Finding the location of the record with a given key value or
finding the location of all records which satisfy one or more conditions.
 Sorting: Arranging the data in logical order.
 Merging:- Combining the records in two different sorted files into a single
sorted file.
16. Define pointer.
Pointers are special variables which contain the address of another memory
location.
17. State about array
An array is a collection of data elements of similar data types.
PART - B
1. What is complexity? Explain its types with example. (16)
2. Explain how to analysis an algorithm with suitable example.(16)
3. Discuss about the concepts of recursion in details.(8)
4. Briefly discuss about various operations of an array.(16)
5. Compare and explain pointers and arrays.(8)
UNIT II – PART A
1. Write about infix notation.
infix notation: X + Y
Operators are written in-between their operands.
2. Write about postfix notation.
Postfix notation (also known as "Reverse Polish notation"): X Y +
Operators are written after their operands.
3
3. Define stack. Give an example.
Stack is a linear data structure in which addition or deletion of elements takes place at
same end.
This end is often called the ‘top’ of the stack.
Example
Stack of plates, Stack of coins.
4. How to represent a stack in an array.
Draw the diagram from page no 130 and explain
5. List down the application of stack.
 Reversing a List
 Polish Notations
 Conversion of infix to Postfix expression
 Evaluation of Postfix Expression
 Conversion of infix to Prefix expression
 Evaluation of Prefix Expression
6. Define queue. Give an example.
Queue is a linear list of elements in which deletion of an element can take place
only at one end, called the front and insertion can take place only at the other end called
rear. The first element in the queue will be the first one to be removed from the list.
There for e Queues are also called FIFO lists.
Example:People waiting in the counter to purchase tickets
Computer examples: Queue of tasks waiting for the line printer .
7. Define circular queue.
Circular queues are the queues implemented in circular form rather than in a straight
line. Circular queues overcome the problem of unutilized space in linear queue
implemented as an array.
8. Define double ended queue.
A deque is a linear list in which elements can be added or removed at either end but not
in the middle. The items can be added or deleted from the front or rear end, but no
changes can be made elsewhere in the list.
9. What is priority queue? Given an example.
A priority queue is a collection of elements where each element is assigned a priority
and the order in which elements are deleted and processed is determined from the
following rules:
i. An element of higher priority is processed before any element of lower priority
ii. Two elements with the same priority are processed according to the order in
which they are added to the queue.
Timesharing system: - Programs of high priority are processed first, and programs with
the same priority form a standard queue.
10. What are the applications of queue?
 Airport Simulation
 Random Numbers
Part B
1. Explain various representation of stack with example.
4
2. Explain the following
i. Infix to postfix
ii. Evaluation of postfix expression.
3. Explain the following
i. Infix to prefix
ii. Evaluation of prefix.
4. Explain the concepts of circular queue with example.
5. Explain double ended queue with example.
6. Explain priority queue with example.
UNIT -III
1. Define Tree
Tree is non linear data structures. It is mainly used to represent data containing a
hierarchical relationship between elements.
2. List out the types of tree
a. General Tree
b. Binary Search Tree
c. Extended Binary Tree or 2 – Tree
d. Threaded Binary Tree
e. AVL Tree
f. 2 – 3 Tree
g. Heap
h. B – Tree.
i. Forest.
3. Give a example of tree.
Records, Family trees and table of contents.
4. State about binary tree
Binary tree is special type of tree in which every node or vertex has either no children,
one child, or two children. A binary tree is an important class of tree data structure in
which a node can have at most two children.
5. Write about binary search tree
The items must be stored in such a way that the key values in left subtree of the root are
less than the key value of the root, and the key values of all the nodes in the right
subtree of the root are greater than the key value of the root. When this relationship
holds in all the nodes in the tree then the tree is called a binary search tree.
5
6. What do you mean by siblings in a tree?
All the children of a given vertex or node are known as siblings.
7. Write about strictly binary tree.
If every non-leaf node in a binary tree has a non-empty left and right sub trees, the tree
is known as strictly binary tree.
8. Write about Red black trees
A red-black tree is an augmented binary search tree in which the arrangement of
vertices obeys the following constraints
 (Black rule): Every leaf is colored black.
 (Red rule): If a vertex is red, then both of its children are black.
 (Path rule) Every path from the root to a leaf contains the same number of black
vertices.
9. Define Degree
Degree of a node is the number of nodes connected to a particular node
6
In this tree the node is containing the data D has a degree 3. The degree of a leaf node
is always one.
10. What do you mean by height and depth of a tree.
The depth of a node is the number of edges from the root to the node. The height of a
node is the number of edges from the node to the deepest leaf. The height of a tree is
a height of the root. A full binary tree is a binary tree in which each node has exactly
zero or two children.
11. Define Heap.
Heap is complete binary tree. There are two types of heaps. If the value present at any
node is greater than its children, then the tree is called the max-heap. In the case of min-
heap the value present at any node is smaller than all its children
12. What are the different types of tree representation?
 List representation
 Representation of degree two tree
13. What are the Binary Tree Traversals?
 Preorder Traversal –
1. Visit the Root first,
2. Traverse the left subtree in preorder and
3. Traverse the right subtree in pre-order (Root-Left-Right Traversal )
 Inorder Traversal –
1. Traverse the (inorder)left subtree,
2. Visit the Root and
3. Traverse the (inorder) right subtree (Left-Root-Right Traversal )
 Postorder Traversal –
1. Traverse the left subtree in postorder
2. Traverse the right subtree in postorder,
3. Visit the Root (Left-Right-Root Traversal )
7
Part B
1. Explain Various type of trees
2. Briefly write about representation of trees
3. Describe tree traversal with an algorithm
Unit IV
1. Define Sorting
Sorting refers to the operation of arranging a set of data in some given order.
2. Write about internal sorting and external sorting
If all the data that is to be sorted can be adjusted at a time in main memory, the internal
sorting methods are used.
When the data to be sorted cannot be accommodated in the memory at the same time
and some has to be kept in auxiliary memory, then external sorting methods are used.
3. List out the type of sorting.
a. Bubble Sorting
b. Selection Sorting
c. Insertion Sorting
d. Radix Sorting
e. Shell Sorting
f. Heap Sorting
g. Binary Tree Sorting
h. Merge Sorting
4. Define searching
Searching is an operation which finds the place of a given element in the list. The search
is said to be successful or unsuccessful depending upon whether the element that is
being searched is found or not.
5. Mention the various types of searching
a. Linear Search
b. Binary Search
c. Indexed Sequential Search
6. Write about selection sorting
A sorting technique that is typically used for sequencing small lists. It starts by
comparing the entire list for the lowest item and moves it to the #1 position. It then
compares the rest of the list for the next-lowest item and places it in the #2 position and
so on until all items are in the required order. Selection sorts perform numerous
comparisons, but fewer data movements than other methods.
7. Write about bubble sorting.
8
Bubble Sort is an algorithm which is used to sort N elements that are given in a memory
for eg: an Array withN number of elements. Bubble Sort compares all the element one
by one and sort them based on their values.
It is called Bubble sort, because with each iteration the smaller element in the list
bubbles up towards the first place, just like a water bubble rises up to the water surface.
8. Define quick sort
In this method, an element called pivot is identified and that element is fixed in its place
by moving all the elements less than that to its left and all the elements greater than that
to its right.
Part B
1. Explain about Bubble sort with an example
2. Briefly write about searching techniques with an example
3. Explain about Insertion sort with an example
4. Describe selection and heap sort with an example
UNIT V
1.Define graph. How does it differ from tree?
A graph is a collection of nodes, called vertices and like segments, called arcs or edges
that connect pairs of nodes In other words, a graph consists of two sets. A set of vertices and a
set of lines. Graphs may be either directed or undirected.
Tree is special form of graph i.e. minimally connected graph and having only one path
between any two vertices.
Tree is a special case of graph having no loops, no circuits and no self-loops.
2 .Define directed graph or digraph?
It is a graph in which each line has a direction (arrow head) to its successor. The lines
in a directed graph are known as arcs. In a directed graph, the flow along the arcs
between two vertices can follow only the indicated direction.
3 .Define undirected graph.
It is a graph in which there is no direction (arrow head) on any of the lines, which are
known as edge. In an undirected graph, the flow between two vertices can go in either
direction.
4. Define adjacent vertices.
Two vertices in graph are said to be adjacent vertices or neighbors if an
edge directly connects them
5. Define path.
A path is a sequence of vertices in which each vertex is adjacent to the next one.
6.Define single source shortest path.
9
The single-source shortest path problem, in which we have to find shortest paths from
a source vertex v to all other vertices in the graph.
7. Define all pair shortest path.
The shortest path problem is the problem of finding a path between two vertices (or nodes) in
a graph such that the sum of the weights of its constituent edges is minimized.
8. What is completely connected graph?
A graph G is completely connected if for every pair of distinct vertices
vi,vj there exists an edge.
9. How to represent graph?
There are two standard ways to represent a graph G=(V, E) as a collection of adjacency
list or as adjacency matrix either way is applicable to both directed and undirected graphs.
10. Differentiate tree and graph.
Write any four differences frombelow point.
Difference between Trees and Graphs
Trees Graphs
Path Tree is special form of graph i.e. minimally
connected graph and having only one path
between any two vertices.
In graph there can be more than one path
i.e. graph can have uni-directional or bi-
directional paths (edges) between nodes
Loops Tree is a special case of graph having no loops,
no circuits and no self-loops.
Graph can have loops, circuits as well as
can have self-loops.
Root Node In tree there is exactly one root node and
every child have only one parent.
In graph there is no such concept
of root node.
Parent Child
relationship
In trees, there is parent child relationship so flow
can be there with direction top to bottom or vice
versa.
In Graph there is no such parent child
relationship.
Complexity Trees are less complex then graphs as having no
cycles, no self-loops and still connected.
Graphs are more complex in compare to
trees as it can have cycles, loops etc
Types of
Traversal
Tree traversal is a kind of special case of traversal
of graph. Tree is traversed in Pre-Order, In-
Order and Post-Order(all three in DFS or in BFS
algorithm)
Graph is traversed by DFS: Depth First
Searchand in BFS : Breadth First
Search algorithm
Connection
Rules
In trees, there are many rules / restrictions for
making connections between nodes through
edges.
In graphs no such rules/ restrictions are
there for connecting the nodes through
edges.
DAG Trees come in the category of DAG : Directed
Acyclic Graphs is a kind of directed graph that
have no cycles.
Graph can be Cyclic or Acyclic.
Different
Types
Different types of trees are : Binary Tree , Binary
Search Tree, AVL tree, Heaps.
There are mainly two types of Graphs
: Directed and Undirected graphs.
Applications Tree applications : sorting and searching like Tree
Traversal & Binary Search.
Graph applications : Coloring of maps, in
OR (PERT & CPM), algorithms, Graph
10
coloring, job scheduling, etc.
No. of edges Tree always has n-1 edges. In Graph, no. of edges depend on the
graph.
Model Tree is a hierarchical model. Graph is a network model.
Figure

More Related Content

What's hot

Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListManishPrajapati78
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
Array operations
Array operationsArray operations
Array operationsZAFAR444
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm KristinaBorooah
 
Graph representation
Graph representationGraph representation
Graph representationTech_MX
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structureVardhil Patel
 
trees in data structure
trees in data structure trees in data structure
trees in data structure shameen khan
 
Threaded Binary Tree
Threaded Binary TreeThreaded Binary Tree
Threaded Binary Treekhabbab_h
 

What's hot (20)

Arrays
ArraysArrays
Arrays
 
Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Array operations
Array operationsArray operations
Array operations
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Extensible hashing
Extensible hashingExtensible hashing
Extensible hashing
 
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures  Design-Notes-Searching-Hashing.pdfAD3251-Data Structures  Design-Notes-Searching-Hashing.pdf
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
 
Graph representation
Graph representationGraph representation
Graph representation
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Linked list
Linked listLinked list
Linked list
 
CS8391 Data Structures 2 mark Questions - Anna University Questions
CS8391 Data Structures 2 mark Questions - Anna University QuestionsCS8391 Data Structures 2 mark Questions - Anna University Questions
CS8391 Data Structures 2 mark Questions - Anna University Questions
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Threaded Binary Tree
Threaded Binary TreeThreaded Binary Tree
Threaded Binary Tree
 
AD3251-Data Structures Design-Notes-Tree.pdf
AD3251-Data Structures  Design-Notes-Tree.pdfAD3251-Data Structures  Design-Notes-Tree.pdf
AD3251-Data Structures Design-Notes-Tree.pdf
 

Similar to Data Structure Question Bank(2 marks)

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
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
SIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptxSIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptxsagabo1
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductionsirshad17
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESsuthi
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdfSulabhPawaia
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questionsProf. Dr. K. Adisesha
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxsarala9
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxSaralaT3
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)Madishetty Prathibha
 
Bit by bit into data structures
Bit by bit into data structuresBit by bit into data structures
Bit by bit into data structuresHridyesh Bisht
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyMalikireddy Bramhananda Reddy
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptxssuser031f35
 

Similar to Data Structure Question Bank(2 marks) (20)

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
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
SIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptxSIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptx
 
Data structure
 Data structure Data structure
Data structure
 
104333 sri vidhya eng notes
104333 sri vidhya eng notes104333 sri vidhya eng notes
104333 sri vidhya eng notes
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
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.pdf
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questions
 
M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
 
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
 
Data structures
Data structuresData structures
Data structures
 
Datastructure
DatastructureDatastructure
Datastructure
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
 
Bit by bit into data structures
Bit by bit into data structuresBit by bit into data structures
Bit by bit into data structures
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
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
 
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
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
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
 

Recently uploaded (20)

OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
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
 
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
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
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
 

Data Structure Question Bank(2 marks)

  • 1. 1 Course/Year/Sem: B.Sc/ I / II UCS18202 – Data Structures UNIT – I -Part A 1. Define data structure? Data structures is the branch of computer science that unleashes the knowledge of how the data should be organized, how the flow of data should be controlled, and how a data structure should be designed and implemented to reduce the complexity and increase the efficiency of the algorithm. 2. What is the need of a data structure? A data structure helps you to understand the relationship of one data element with the other and organize it within the memory. 3. Write about asymptotic notation. The complexity of algorithm is analyzed through asymptotic notations. The notation are Big oh, Omega &Theta. 4. What is recursion? A recursion routine is one whose design includes a call to itself. 5. Why Big ‘O’ notation. Big ‘O’ notation, determine the time taken by the algorithm, and also the amount of space required to run the algorithm. 6. Define a list. List the term used to refer to the linear collection of data items. 7. State about Linked List. Linked list is a linear collection of data elements, called nodes, where the linear order is implemented by means of pointers. A linked list allocates memory for storing list elements and connects elements together using pointers. 8. List out types of time complexity. i. Best case time complexity. ii. Average time complexity iii. Worst case complexity. 9. Write about time complexity. The time needed by an algorithm expressed as a function of the size of a problem is called the TIME COMPLEXITY of the algorithm. The time complexity of a program is the amount of computer time it needs to run to completion. 10. What do you mean by space complexity? The space complexity of a program is the amount of memory it needs to run to completion. 11. Define best case time complexity. The best case time complexity of an algorithm is a measure of the minimum time that the algorithm will require for an input of size “n”. 12. Define worst case time complexity. SRM INSTITUTE OF SCIENCE AND TECHNOLOGY Ramapuram Campus Department of computer applications
  • 2. 2 The worst case time complexity of an algorithm is a measure of the maximum time that the algorithm will require for an input of size “n”. 13. Define average case time complexity. The average case time complexity of an algorithm is a measure of the average time that the algorithm will require for an input of size “n”. 14. Define linear and non linear data structure. Linear Data Structure:- A data structure is said to be linear if its elements form a sequence or a linear list. The linear data structures like an array, stacks, queues and linked lists organize data in linear order. Non Linear Structure:- A data structure is said to be non linear if its elements form a hierarchical classification where, data items appear at various levels. Trees and Graphs are widely used non-linear data structures. Tree and graph structures representhierarchical relationship between individual data elements. Graphs are nothing but trees with certain restrictions removed. 15. List out the operations performed on data structure  Insertion:-Insertion means adding new node into the data structures.  Deletion:- Deletion means removing a node from the data structures.  Traversal:- Traversing means accessing each record exactly once so that certain items in the record may be processed.  Searching: Finding the location of the record with a given key value or finding the location of all records which satisfy one or more conditions.  Sorting: Arranging the data in logical order.  Merging:- Combining the records in two different sorted files into a single sorted file. 16. Define pointer. Pointers are special variables which contain the address of another memory location. 17. State about array An array is a collection of data elements of similar data types. PART - B 1. What is complexity? Explain its types with example. (16) 2. Explain how to analysis an algorithm with suitable example.(16) 3. Discuss about the concepts of recursion in details.(8) 4. Briefly discuss about various operations of an array.(16) 5. Compare and explain pointers and arrays.(8) UNIT II – PART A 1. Write about infix notation. infix notation: X + Y Operators are written in-between their operands. 2. Write about postfix notation. Postfix notation (also known as "Reverse Polish notation"): X Y + Operators are written after their operands.
  • 3. 3 3. Define stack. Give an example. Stack is a linear data structure in which addition or deletion of elements takes place at same end. This end is often called the ‘top’ of the stack. Example Stack of plates, Stack of coins. 4. How to represent a stack in an array. Draw the diagram from page no 130 and explain 5. List down the application of stack.  Reversing a List  Polish Notations  Conversion of infix to Postfix expression  Evaluation of Postfix Expression  Conversion of infix to Prefix expression  Evaluation of Prefix Expression 6. Define queue. Give an example. Queue is a linear list of elements in which deletion of an element can take place only at one end, called the front and insertion can take place only at the other end called rear. The first element in the queue will be the first one to be removed from the list. There for e Queues are also called FIFO lists. Example:People waiting in the counter to purchase tickets Computer examples: Queue of tasks waiting for the line printer . 7. Define circular queue. Circular queues are the queues implemented in circular form rather than in a straight line. Circular queues overcome the problem of unutilized space in linear queue implemented as an array. 8. Define double ended queue. A deque is a linear list in which elements can be added or removed at either end but not in the middle. The items can be added or deleted from the front or rear end, but no changes can be made elsewhere in the list. 9. What is priority queue? Given an example. A priority queue is a collection of elements where each element is assigned a priority and the order in which elements are deleted and processed is determined from the following rules: i. An element of higher priority is processed before any element of lower priority ii. Two elements with the same priority are processed according to the order in which they are added to the queue. Timesharing system: - Programs of high priority are processed first, and programs with the same priority form a standard queue. 10. What are the applications of queue?  Airport Simulation  Random Numbers Part B 1. Explain various representation of stack with example.
  • 4. 4 2. Explain the following i. Infix to postfix ii. Evaluation of postfix expression. 3. Explain the following i. Infix to prefix ii. Evaluation of prefix. 4. Explain the concepts of circular queue with example. 5. Explain double ended queue with example. 6. Explain priority queue with example. UNIT -III 1. Define Tree Tree is non linear data structures. It is mainly used to represent data containing a hierarchical relationship between elements. 2. List out the types of tree a. General Tree b. Binary Search Tree c. Extended Binary Tree or 2 – Tree d. Threaded Binary Tree e. AVL Tree f. 2 – 3 Tree g. Heap h. B – Tree. i. Forest. 3. Give a example of tree. Records, Family trees and table of contents. 4. State about binary tree Binary tree is special type of tree in which every node or vertex has either no children, one child, or two children. A binary tree is an important class of tree data structure in which a node can have at most two children. 5. Write about binary search tree The items must be stored in such a way that the key values in left subtree of the root are less than the key value of the root, and the key values of all the nodes in the right subtree of the root are greater than the key value of the root. When this relationship holds in all the nodes in the tree then the tree is called a binary search tree.
  • 5. 5 6. What do you mean by siblings in a tree? All the children of a given vertex or node are known as siblings. 7. Write about strictly binary tree. If every non-leaf node in a binary tree has a non-empty left and right sub trees, the tree is known as strictly binary tree. 8. Write about Red black trees A red-black tree is an augmented binary search tree in which the arrangement of vertices obeys the following constraints  (Black rule): Every leaf is colored black.  (Red rule): If a vertex is red, then both of its children are black.  (Path rule) Every path from the root to a leaf contains the same number of black vertices. 9. Define Degree Degree of a node is the number of nodes connected to a particular node
  • 6. 6 In this tree the node is containing the data D has a degree 3. The degree of a leaf node is always one. 10. What do you mean by height and depth of a tree. The depth of a node is the number of edges from the root to the node. The height of a node is the number of edges from the node to the deepest leaf. The height of a tree is a height of the root. A full binary tree is a binary tree in which each node has exactly zero or two children. 11. Define Heap. Heap is complete binary tree. There are two types of heaps. If the value present at any node is greater than its children, then the tree is called the max-heap. In the case of min- heap the value present at any node is smaller than all its children 12. What are the different types of tree representation?  List representation  Representation of degree two tree 13. What are the Binary Tree Traversals?  Preorder Traversal – 1. Visit the Root first, 2. Traverse the left subtree in preorder and 3. Traverse the right subtree in pre-order (Root-Left-Right Traversal )  Inorder Traversal – 1. Traverse the (inorder)left subtree, 2. Visit the Root and 3. Traverse the (inorder) right subtree (Left-Root-Right Traversal )  Postorder Traversal – 1. Traverse the left subtree in postorder 2. Traverse the right subtree in postorder, 3. Visit the Root (Left-Right-Root Traversal )
  • 7. 7 Part B 1. Explain Various type of trees 2. Briefly write about representation of trees 3. Describe tree traversal with an algorithm Unit IV 1. Define Sorting Sorting refers to the operation of arranging a set of data in some given order. 2. Write about internal sorting and external sorting If all the data that is to be sorted can be adjusted at a time in main memory, the internal sorting methods are used. When the data to be sorted cannot be accommodated in the memory at the same time and some has to be kept in auxiliary memory, then external sorting methods are used. 3. List out the type of sorting. a. Bubble Sorting b. Selection Sorting c. Insertion Sorting d. Radix Sorting e. Shell Sorting f. Heap Sorting g. Binary Tree Sorting h. Merge Sorting 4. Define searching Searching is an operation which finds the place of a given element in the list. The search is said to be successful or unsuccessful depending upon whether the element that is being searched is found or not. 5. Mention the various types of searching a. Linear Search b. Binary Search c. Indexed Sequential Search 6. Write about selection sorting A sorting technique that is typically used for sequencing small lists. It starts by comparing the entire list for the lowest item and moves it to the #1 position. It then compares the rest of the list for the next-lowest item and places it in the #2 position and so on until all items are in the required order. Selection sorts perform numerous comparisons, but fewer data movements than other methods. 7. Write about bubble sorting.
  • 8. 8 Bubble Sort is an algorithm which is used to sort N elements that are given in a memory for eg: an Array withN number of elements. Bubble Sort compares all the element one by one and sort them based on their values. It is called Bubble sort, because with each iteration the smaller element in the list bubbles up towards the first place, just like a water bubble rises up to the water surface. 8. Define quick sort In this method, an element called pivot is identified and that element is fixed in its place by moving all the elements less than that to its left and all the elements greater than that to its right. Part B 1. Explain about Bubble sort with an example 2. Briefly write about searching techniques with an example 3. Explain about Insertion sort with an example 4. Describe selection and heap sort with an example UNIT V 1.Define graph. How does it differ from tree? A graph is a collection of nodes, called vertices and like segments, called arcs or edges that connect pairs of nodes In other words, a graph consists of two sets. A set of vertices and a set of lines. Graphs may be either directed or undirected. Tree is special form of graph i.e. minimally connected graph and having only one path between any two vertices. Tree is a special case of graph having no loops, no circuits and no self-loops. 2 .Define directed graph or digraph? It is a graph in which each line has a direction (arrow head) to its successor. The lines in a directed graph are known as arcs. In a directed graph, the flow along the arcs between two vertices can follow only the indicated direction. 3 .Define undirected graph. It is a graph in which there is no direction (arrow head) on any of the lines, which are known as edge. In an undirected graph, the flow between two vertices can go in either direction. 4. Define adjacent vertices. Two vertices in graph are said to be adjacent vertices or neighbors if an edge directly connects them 5. Define path. A path is a sequence of vertices in which each vertex is adjacent to the next one. 6.Define single source shortest path.
  • 9. 9 The single-source shortest path problem, in which we have to find shortest paths from a source vertex v to all other vertices in the graph. 7. Define all pair shortest path. The shortest path problem is the problem of finding a path between two vertices (or nodes) in a graph such that the sum of the weights of its constituent edges is minimized. 8. What is completely connected graph? A graph G is completely connected if for every pair of distinct vertices vi,vj there exists an edge. 9. How to represent graph? There are two standard ways to represent a graph G=(V, E) as a collection of adjacency list or as adjacency matrix either way is applicable to both directed and undirected graphs. 10. Differentiate tree and graph. Write any four differences frombelow point. Difference between Trees and Graphs Trees Graphs Path Tree is special form of graph i.e. minimally connected graph and having only one path between any two vertices. In graph there can be more than one path i.e. graph can have uni-directional or bi- directional paths (edges) between nodes Loops Tree is a special case of graph having no loops, no circuits and no self-loops. Graph can have loops, circuits as well as can have self-loops. Root Node In tree there is exactly one root node and every child have only one parent. In graph there is no such concept of root node. Parent Child relationship In trees, there is parent child relationship so flow can be there with direction top to bottom or vice versa. In Graph there is no such parent child relationship. Complexity Trees are less complex then graphs as having no cycles, no self-loops and still connected. Graphs are more complex in compare to trees as it can have cycles, loops etc Types of Traversal Tree traversal is a kind of special case of traversal of graph. Tree is traversed in Pre-Order, In- Order and Post-Order(all three in DFS or in BFS algorithm) Graph is traversed by DFS: Depth First Searchand in BFS : Breadth First Search algorithm Connection Rules In trees, there are many rules / restrictions for making connections between nodes through edges. In graphs no such rules/ restrictions are there for connecting the nodes through edges. DAG Trees come in the category of DAG : Directed Acyclic Graphs is a kind of directed graph that have no cycles. Graph can be Cyclic or Acyclic. Different Types Different types of trees are : Binary Tree , Binary Search Tree, AVL tree, Heaps. There are mainly two types of Graphs : Directed and Undirected graphs. Applications Tree applications : sorting and searching like Tree Traversal & Binary Search. Graph applications : Coloring of maps, in OR (PERT & CPM), algorithms, Graph
  • 10. 10 coloring, job scheduling, etc. No. of edges Tree always has n-1 edges. In Graph, no. of edges depend on the graph. Model Tree is a hierarchical model. Graph is a network model. Figure