Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
130 views

Data Structure Course

This document outlines the syllabus for a Data Structures course. The course covers 5 units: strings, stacks, trees, graphs, and hashing. Key topics include string functions, stack operations, binary trees, tree traversals, binary search trees, graphs, graph traversals, and hashing techniques. The syllabus lists 2 textbooks, course outcomes mapped to program outcomes and purposes, a course schedule dividing topics and hours across units, and contact class hours.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views

Data Structure Course

This document outlines the syllabus for a Data Structures course. The course covers 5 units: strings, stacks, trees, graphs, and hashing. Key topics include string functions, stack operations, binary trees, tree traversals, binary search trees, graphs, graph traversals, and hashing techniques. The syllabus lists 2 textbooks, course outcomes mapped to program outcomes and purposes, a course schedule dividing topics and hours across units, and contact class hours.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 48

Department of Computer Science and Engineering

Course Name : DATA STRUCTURES

Course Number :

Course Designation: Core

Prerequisites : C Programming

II B Tech – I Semester
(2015-2016)

THOTA PANDU RANGA


2

SYLLABUS

Introduction: What is data structure, Types of data structures, Static and Dynamic
representation of data structure and comparison. Strings:String definition, String built-in
functions (strlen(),strcpy(),strcat(),strcmp(),strrev()), Strings and Pointers (Ch-3,T3)
Stacks: Stacks definition, operations on stacks, Representation and evaluation of
Unit – I
expressions using Infix, Prefix and Postfix, Algorithms for conversions and evaluations of
expressions from infix to prefix and postfix using stack.
.

Trees: Basic terminology, Types of trees: Binary Tree: terminology, Complete and Full
Binary Tree, Extended Binary Trees, Threaded Binary Trees and In order Threading.
Representation of Trees using Arrays and Linked lists (advantages and disadvantages).
Unit – II
Tree Traversal and Representation of Algebraic expressions; Algorithms for Tree
Traversals.
.
Advanced concepts on trees: Representation and Creation of Binary Search Trees (BST),
Algorithm for Inserting, deleting and Searching in BST. Representation and advantages of
Unit – III AVL Trees, Algorithms on AVL Trees-Insertion, Rotation and Deletion. Definition and
advantages of B-trees, B + Trees, Red-Black Trees, M-way trees with examples.

Graphs-Basic terminology, Representation of graphs: sequential representation


(Adjacency, Path Matrix) Linked representation.
Unit – IV Graph Traversals-Breadth First Search, Depth First Search with algorithms. Definition and
properties of Spanning Tree, Minimum Spanning Tree, Dijkstra Algorithms.

Hashing: General Idea, Hash Functions, Separate Chaining ,Open Addressing-Linear


probing, Quadratic Probing, Double Hashing, Rehashing, Extensible Hashing, Collisions
Unit – V
in Hashing, Implementation of Dictionaries
.
3

Text Books:

1. Data Structures, Seymour Lipschutz, Schaum’s Outlines, Tata McGraw-Hill, Special Second
Edition.
2. Data Structures, A Pseudo code Approach with C, Richard F.Gillberg & Behrouz A.
Forouzan, Cengage Learning, India Edition, Second Edition, 2005.

Reference Books:

1. “Data Structures Using C and C++”, Aaron M. Tenenbaum,Yedidyah Langsam and Moshe J.
Augenstein PHI Learning Private Limited, Delhi India.
2. “Fundamentals of Data Structures”, Horowitz and Sahani, Galgotia Publications Pvt Ltd
Delhi India.
3. Data Structure Using C, A.K. Sharma , Pearson Education India.
4. “Data Structure Using C and C++”, Rajesh K. Shukla, Wiley Dreamtech Publication.
5. “Data Structures”, Lipschutz, Schaum’s Outline Series, Tata Mcgraw-hill Education (India)
Pvt. Ltd .
6. “Data Structures and Algorithms in C++”, Michael T. Goodrich, Roberto Tamassia, David M.
Mount, Wiley India.

Websites References

1. https://www.dsalgo.com

2. https:// www.quora.com

3. https://discuss.codechef.com/
4

Time Table

Room No: W.E.F:


Class 1 2 3 4 5 6 7 8
Hour
9:00 09.50 – 10:40 – 11:30 – 1:00 – 1:50 – 2:40 – 3:30 –

LUNCH BREAK 12:20 – 1:00


Time -09:50 10:40 11:30 12: 20 1:50 2:40 3:30 4.20

MON

TUE

WED

THU

FRI

SAT

PROGRAM EDUCATIONAL OBJECTIVES (PEO’s)

PEO1 The Graduates are employable as software professionals in reputed industries.

PEO2 The Graduates analyze problems by applying the principles of computer science,


5

mathematics and scientific investigation to design and implement industry


accepted solutions using latest technologies.

PEO3 The Graduates work productively in supportive and leadership roles on


multidisciplinary teams with effective communication and team work skills with
high regard to legal and ethical responsibilities.

PEO4 The Graduates embrace lifelong learning to meet ever changing developments in
computer science and Engineering.

PROGRAM OUTCOMES (PO’s)

PO1 An ability to communicate effectively and work on multidisciplinary teams

PO2 An ability to identify, formulate and solve computer system problems with
professional and ethical responsibility.

PO3 A recognition of the need for, and an ability to engage in life-long learning to use
the latest techniques, skills and modern engineering tools

PO4 The broad education necessary to understand the impact of engineering solutions
in a global, economic, environmental and social context

PO5 An ability to apply knowledge of mathematics, science, and computing to analyze,


design and implement solutions to the realistic problems.

PO6 An ability to apply suitable process with the understanding of software


development practice.

DATA STRUCTURES
COURSE OUTCOMES
1. Learn about primary data structures.
2. Represent the problem in a form of graphs and trees.
3. Apply the concept of graphs and trees with respect to search,insert,delete
in a network
4. To know about dictionaries and hashing methods to use the data
structures.
6

MAPPING OF COURSE OUT COMES WITH


PO’s & PEO’s

Course Outcomes PO’s PEO’s

CO1 PO2 PE02

CO2 PO5 PE02

CO3 PO5 PE05

C04 PO6 PE05

COURSE SCHEDULE

Distribution of Hours Unit – Wise


Chapters Total No.
Unit Topic
of Hours
Book1 Book2
I Introduction: What is data structure, Chapters 1,3,6 Chapters 1,3,4 11
Types of data structures, Static and
Dynamic representation of data structure
and comparison. Strings:String
definition, String built-in functions
(strlen(),strcpy(),strcat(),strcmp(),strrev()),
7

Strings and Pointers (Ch-3,T3) Stacks:


Stacks definition, operations on stacks,
Representation and evaluation of
expressions using Infix, Prefix and
Postfix, Algorithms for conversions and
evaluations of expressions from infix to
prefix and postfix using stack.
.

Trees: Basic terminology, Types of trees:


Binary Tree: terminology, Complete and
Full Binary Tree, Extended Binary Trees,
Threaded Binary Trees and In order
Threading. Representation of Trees using
II Chapter 7 Chapters 6 11
Arrays and Linked lists (advantages and
disadvantages). Tree Traversal and
Representation of Algebraic expressions;
Algorithms for Tree Traversals.

Advanced concepts on trees:


Representation and Creation of Binary
Search Trees (BST), Algorithm for
Inserting, deleting and Searching in BST.
Representation and advantages of AVL
III Trees, Algorithms on AVL Trees- Chapter 7 Chapters .7,8,10 11
Insertion, Rotation and Deletion.
Definition and advantages of B-trees, B +
Trees, Red-Black Trees, M-way trees with
examples.

Graphs-Basic terminology, Representation


of graphs: sequential representation
(Adjacency, Path Matrix) Linked
representation.
Graph Traversals-Breadth First Search,
IV Chapters 8 Chapter 11 11
Depth First Search with algorithms.
Definition and properties of Spanning
Tree, Minimum Spanning Tree, Dijkstra
Algorithms.

Hashing: General Idea, Hash Functions,


Separate Chaining ,Open Addressing-
Linear probing, Quadratic Probing,
V Double Hashing, Rehashing, Extensible Chapter 13 10
Hashing, Collisions in Hashing,
Implementation of Dictionaries
.
8

Contact classes for Syllabus coverage 54

Revision classes :1 per unit


Online Quiz : 1 per mid
9
Descriptive Tests : 02 (Before Mid Examination)

Number of Hours / lectures available in this Semester / Year 63

The number of topic in every unit is not the same – because of the variation, all the units
have an unequal distribution of hours

Lecture Plan
S. No. Topic

Unit-1

What is data structure, Types of data structures, Static and


1 2
Dynamic representation of data structure and comparison.

Strings:String definition, String built-in functions


2 1
(strlen(),strcpy(),strcat(),strcmp(),strrev())

3 Strings and Pointers 1

4 Stacks definition, operations on stacks 2

Representation and evaluation of expressions using Infix, Prefix


5 2
and Postfix

Algorithms for conversions and evaluations of expressions from


6 3
infix to prefix and postfix using stack

Total No. of classes 11

Unit-2

1 Trees: Basic terminology, Types of trees 1

2 Binary Tree: terminology, 1

3 Complete and Full Binary Tree, Extended Binary Trees 1

4 Threaded Binary Trees and In order Threading 2


9

Representation of Trees using Arrays and Linked lists (advantages


5 2
and disadvantages)

6 Tree Traversal and Representation of Algebraic expressions 2

7 Algorithms for Tree Traversals 2

Total No. of classes 11

Unit-3

1 Representation and Creation of Binary Search Trees (BST) 1

2 Algorithm for Inserting, deleting and Searching in BST 2

3 Representation and advantages of AVL Trees 2

4 Algorithms on AVL Trees-Insertion, Rotation and Deletion 3

Definition and advantages of B-trees, B + Trees, Red-Black Trees,


5 M-way trees with examples. 3

Total No. of classes 11

Unit-4

1 Graphs-Basic terminology 1

2 Representation of graphs: sequential representation (Adjacency, 3


Path Matrix) Linked representation.
Graph Traversals-Breadth First Search, Depth First Search with
3 3
algorithms

Definition and properties of Spanning Tree, Minimum Spanning


4 2
Tree

5 Dijkstra Algorithms 2

Total No. of classes 11

Unit-5

1 Hashing: General Idea 2

2 Hash Functions 2

3 Open Addressing-Linear probing, Quadratic Probing, Double 3


10

Hashing, Rehashing, Extensible Hashing, Collisions in Hashing,

4 Implementation of Dictionaries 3

Total No. of classes 10

Unit I 11
Unit II 11
Unit III 11
Unit IV 11
Unit V 10
---------------------------------
Total 54
--------------------------------

Date of Unit Completion & Remarks

Unit – 1

Date : __ / __ / __

Remarks:
________________________________________________________________________

________________________________________________________________________

Unit – 2

Date : __ / __ / __
11

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 3

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 4

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________

Unit – 5

Date : __ / __ / __

Remarks:

________________________________________________________________________

________________________________________________________________________
12

Unit Wise Assignments (With different Levels of thinking (Blooms Taxonomy))


Note: For every question please mention the level of Blooms taxonomy

Unit – 1

1. Define Data Strucutres and explain the different data structures L2

2. Define ADTs Queue, Stack L2


Convert the following infix expressions to equivalent prefix and postfix expressions
3.
i)a+b+c b)a+b*c c)(a+b)*c d)a*b*c/d/+e e)((a+b)*(c+d)/f) L3
Evaluate the following postfix expression.
4. a) 2 3 5 * + b) 9 9 9 9 + - * c)2 3 + 5 - d)3 0 1 * 1 L4

Unit – 2

1. Draw a tree and label it which include degree,height,complete etc.. L2

Draw a binary tree containing your subject names as nodes and traverse it inorder,
2.
preorder and postorder. L4
Draw trees for the expressions :i) a+b*c, ii)(a+b)*(c/d+e) L4
3.

Why threading of trees is done? Explain the different threading methods. L2


4.

Unit – 3
Define a BST? Draw a BST for the marks secured by you in the last semester end
1. examinations then traverse it inorder, preorder and post order. L2

2. Make changes to some of the values to the BST drawn in the Question 1. L4
Define AVL tree. List the advantages over BST. Draw an AVL tree for the marks
3.
secured by you in the end exam. L4
4. Definition and advantages of B-trees, B + Trees, Red-Black Trees, M-way trees with
examples. L4
Unit – 4
Draw a graph and represent it in different ways such as adjacency matrix, adjacency
1.
list L2
2. Draw a graph then traverse it in BFS and DFS

3. Explain the concept Spanning tree and minimum Spanning tree for a given graph.. L2
13

Develop a program for printing the minimum spanning tree for a given graph L2
4.

Unit – 5

1. What is Hashing? Explain its advanateges over other data structures. L2

2. Explain about Open addressing. L2

3. Explain the various Collision resolution techniques L2


Write a program to store any 10 names using appropriate hash function and then
4. search for a given name. L2

Unit Wise Case Studies (With different Levels of thinking (Blooms Taxonomy))
Note: For every Case Study please mention the level of Blooms taxonomy

CASE STUDY- I

A Multi-storied building needs to be wired so that the all the rooms to be connected with least
length of wire for lighting purpose. Develop a solution for the problem . L5
CASE Study- II
An international sports event is organized in a a Metropolitan city. Develop a solution for
parking vehicles of people attending the event L5

Unit Wise Important Questions (With different Levels of thinking (Blooms Taxonomy))
Note: For every question please mention the level of Blooms taxonomy
14

Unit – 1

1. Write a program to implement Stack using Array L3

2. Write a Program to implement Queue using Array. L3

3. Write a program to convert an infix expression to equivalent postfix and prefix L3

4. Write a program to evaluate a postfix expression. L3

Unit – 2
Write a program to determine whether the given tree is complete binary
1. tree or not. L3

2. Write a program to implement a binary tree using Array. L3


Write a program to create a BST tree and search for a given element in
3. it. L3

4. Why threading of trees is done ? Explain the explain the advantages. L3

Unit – 3
Write a program to create an AVL tree for the names of your family
1. members and then search for a given name. L3
Write a program to create a binary search tree and traverse it in inorder,
2. pre order and post order. L3
Write a menu driven program to create a binary search tree and perform
3.
the following operations. Insert, delete, and traverse. L3
4. Definition and advantages of B-trees, B + Trees, Red-Black Trees, M-way trees with
examples L3
Unit – 4
Write a program to represent a graph using adjacency matrix and linked
1.
representation . L3
2. Write a program to traverse a given graph using BFS method. L3

3. Write a program to traverse a given graph using DFS method. L3

4. Write a program to display Spanning tree for a given graph. L3


15

Unit – 5
What is Hashing ? What is the advantages over the other data structures.
1.
L2
2. Write a program to impelement open addressing. L3

3. Write a program to implement Separate Chaining L3

4. Write a program to implement a Dictionary. L3

Unit Wise Multiple Choice Questions for CRT & Competitive Examinations

UNIT-I
MCQs on string functions with answers
1. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. char *str = "hello, world";
5. char *str1 = "hello, world";
6. if (strcmp(str, str1))
7. printf("equal");
8. else
9. printf("unequal");
10. }

a) equal
b) unequal
c) Compilation error
16

d) Depends on the compiler


Answer: b

2. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. char *str = "hello";
5. char str1[5];
6. strcpy(str, str1);
7. printf("%s", str1);
8. }

a) Compilation error
b) Undefined behaviour
c) hello, world
d) hello, wo 9
Answer: d

3. What is the output of this C code?

1. #include <stdio.h>
2. #include <string.h>
3. int main()
4. {
5. char *str = "hello, world";
6. char str1[9];
7. strncpy(str1, str, 9);
8. printf("%s %d", str1, strlen(str1));
9. }

a) hello, world 11
b) hello, wor 9
c) Undefined behaviour
d) Compilation error
Answer: c

4. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. char *str = "hello, world\n";
5. printf("%d", strlen(str));
6.  
7. }
17

a) Compilation error
b) Undefined behaviour
c) 13
d) 11
Answer: c

5. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. char str[11] = "hello";
5. char *str1 = "world";
6. strcat(str, str1);
7. printf("%s %d", str, str[10]);
8. }

a) helloworld 0
b) helloworld anyvalue
c) worldhello 0
d) Segmentation fault/code crash
Answer: a

6. Strcat function adds null character


a) Only if there is space
b) Always
c) Depends on the standard
d) Depends on the compiler
Answer: b

7. What is the output of this C code?

1. #include <stdio.h>
2. int main()
3. {
4. char str[10] = "hello";
5. char *str1 = "world";
6. strncat(str, str1, 9);
7. printf("%s", str);
8. }

a) helloworld
b) Undefined behaviour
c) helloworl
d) hellowor
Answer: a
18

MCQs on stacks with answers

1. The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

a) AB+ CD*E - FG /**


b) AB + CD* E - F **G /
c) AB + CD* E - *F *G /
d) AB + CDE * - * F *G /
ANSWER: a) AB+ CD*E - FG /**
2. The data structure required to check whether an expression contains balanced
parenthesis is?

a) Stack
b) Queue
c) Array
d) Tree
ANSWER: a) Stack
3. What data structure would you mostly likely see in a non recursive implementation of a
recursive algorithm?
a) LinkList
b) Stack
c) Queue
d) Tree
ANSWER: b) Stack
4. The process of accessing data stored in a serial access memory is similar to manipulating
data on a ------?

a) Heap
b) Binary Tree
c) Array
d) Stack
ANSWER: d) Stack
5. The postfix form of A*B+C/D is?

a) *AB/CD+
b) AB*CD/+
c) A*BC+/D
d) ABCD+/*
ANSWER: b) AB*CD/+
6. Which data structure is needed to convert infix notation to postfix notation?

a) Branch
b) Tree
c) Queue
19

d) Stack
ANSWER: d) Stack
7. The prefix form of A-B/ (C * D ⋀ E) is?

a) -/*⋀ACBDE
b) -ABCD*⋀DE
c) -A/B*C⋀DE
d) -A/BC*⋀DE
ANSWER: c) -A/B*C⋀DE

8. What is the result of the following operation


Top (Push (S, X))

a) X
b) Null
c) S
d) None
ANSWER: a) X
9. The prefix form of an infix expression p + q - r * t is?

a) + pq - *rt
b) - +pqr * t
c) - +pq * rt
d) - + * pqrt
ANSWER: c) - +pq * rt
10. Which data structure is used for implementing recursion?

a) Queue
b) Stack
c) Array
d) List
ANSWER: b) Stack
11. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?

a) 600
b) 350
c) 650
d) 588
ANSWER: b) 350
12. Convert the following infix expressions into its equivalent postfix expressions
(A + B ⋀D)/(E - F)+G

a) (A B D ⋀ + E F - / G +)
b) (A B D +⋀ E F - / G +)
c) (A B D ⋀ + E F/- G +)
d) None
ANSWER: a) (A B D ⋀ + E F - / G +)
20

13. Convert the following Infix expression to Postfix form using a stack

x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.

a) xyz*+pq*r+s*+
b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+
d) none
ANSWER: a) xyz*+pq*r+s*+
14. Which of the following statement(s) about stack data structure is/are NOT correct?

a) Stack data structure can be implemented using linked list


b) New node can only be added at the top of the stack
c) Stack is the FIFO data structure
d) The last node at the bottom of the stack has a NULL link
ANSWER: c) Stack is the FIFO data structure
15. Consider the linked list implementation of a stack. Which of the following node is
considered as Top of the stack?

a) First node
b) Last node
c) Any node
d) Middle node
ANSWER: a) First node
16. Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);

After the completion of all operation, the no of element present on stack are

a) 1
b) 2
c) 3
d) 4
ANSWER: a) 1
17. Which of the following is not an inherent application of stack?

a) Reversing a string
b) Evaluation of postfix expression
21

c) Implementation of recursion
d) Job scheduling
ANSWER: d) Job scheduling
18. Which of the following operation take worst case linear time in the array
implementation of stack?

a) Push
b) Pop
c) IsEmpty
d) None
ANSWER: d) None
19. The type of expression in which operator succeeds its operands is?

a) Infix Expression
b) pre fix Expression
c) postfix Expression
d) None
ANSWER: c) postfix Expression
20. Which of the following application generally use a stack?

a) Parenthesis balancing program


b) Syntax analyzer in compiler
c) Keeping track of local variables at run time
d) All of the above
ANSWER: d) All of the above

21. Consider the following array implementation of stack:

#define MAX 10
Struct STACK
{
Int arr [MAX];
Int top = -1;
}

If the array index starts with 0, the maximum value of top which does not cause stack overflow
is?

a) 8
b) 9
c) 10
d) 11
ANSWER: a) 8
22. What is the minimum number of stacks of size n required to implement a queue of size
n?

a) One
22

b) Two
c) Three
d) Four
ANSWER: b) Two
23. Assume that the operators +,-, X are left associative and ⋀ is right associative. The
order of precedence (from highest to lowest) is ⋀, X, +, -. The postfix expression
corresponding to the infix expression a + b X c – d ⋀ e ⋀ f is

a) abc X+ def ⋀ ⋀ -
b) abc X+ de⋀f⋀ -
c) ab+c Xd – e ⋀f⋀
d) -+aXbc⋀ ⋀def
ANSWER: a) abc X+ def ⋀ ⋀ -

24. If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a
time, in what order will they be removed?

a) ABCD
b) DCBA
c) DCAB
d) ABDC
ANSWER: b) DCBA
25. Consider the usual implementation of parentheses balancing program using stack.
What is the maximum number of parentheses that will appear on stack at any instance of
time during the analysis of ( ( ) ( ( ) ) ( ( ) ) )?

a) 1
b) 2
c) 3
d) 4
ANSWER: c) 3

UNIT-II & III

MCQs on Tree with answers

1. The height of a BST is given as h. Consider the height of the tree as the no. of edges in
the longest path from root to the leaf. The maximum no. of nodes possible in the tree is?

a) 2h-1 -1
23

b) 2h+1 -1
c) 2h +1
d) 2h-1 +1
ANSWER: B

2. The no of external nodes in a full binary tree with n internal nodes is?

a) n
b) n+1
c) 2n
d) 2n + 1
ANSWER: B

3. The difference between the external path length and the internal path length of a binary
tree with n internal nodes is?

a) 1
b) n
c) n + 1
d) 2n
ANSWER: D

4. Suppose a binary tree is constructed with n nodes, such that each node has exactly either
zero or two children. The maximum height of the tree will be?

a) (n+1)/2
b) (n-1)/2
c) n/2 -1
d) (n+1)/2 -1
ANSWER: B

5. Which of the following statement about binary tree is CORRECT?

a) Every binary tree is either complete or full


b) Every complete binary tree is also a full binary tree
c) Every full binary tree is also a complete binary tree
d) A binary tree cannot be both complete and full
ANSWER: C

6. Suppose we have numbers between 1 and 1000 in a binary search tree and want to
search for the number 363. Which of the following sequence could not be the sequence of
the node examined?

a) 2, 252, 401, 398, 330, 344, 397, 363


b) 924, 220, 911, 244, 898, 258, 362, 363
24

c) 925, 202, 911, 240, 912, 245, 258, 363


d) 2, 399, 387, 219, 266, 382, 381, 278, 363
ANSWER: C

7. In full binary search tree every internal node has exactly two children. If there are 100
leaf nodes in the tree, how many internal nodes are there in the tree?

a) 25
b) 49
c) 99
d) 101
ANSWER: C

8. Which type of traversal of binary search tree outputs the value in sorted order?

a) Pre-order
b) In-order
c) Post-order
d) None
ANSWER: B

9. Suppose a complete binary tree has height h>0. The minimum no of leaf nodes possible
in term of h is?

a) 2h -1
b) 2h -1 + 1
c) 2h -1
d) 2h +1
ANSWER: C

10. A 2-3 is a tree such that

a) All internal nodes have either 2 or 3 children


b) All path from root to leaves have the same length

The number of internal nodes of a 2-3 tree having 9 leaves could be

a) 4
b) 5
c) 6
d) 7
ANSWER: A, D

11. If a node having two children is to be deleted from binary search tree, it is replaced by
its

a) In-order predecessor
25

b) In-order successor
c) Pre-order predecessor
d) None
ANSWER: B

12. A binary search tree is formed from the sequence 6, 9, 1, 2, 7, 14, 12, 3, 8, 18. The
minimum number of nodes required to be added in to this tree to form an extended binary
tree is?

a) 3
b) 6
c) 8
d) 11
ANSWER: D

13. In a full binary tree, every internal node has exactly two children. A full binary tree
with 2n+1 nodes contains

a) n leaf node
b) n internal nodes
c) n-1 leaf nodes
d) n-1 internal nodes
ANSWER: B

14. the run time for traversing all the nodes of a binary search tree with n nodes and
printing them in an order is

a) O(nlg(n))
b) O(n)
c) O(√n)
d) O(log(n))
ANSWER: B

15. When a binary tree is converted in to an extended binary tree, all the nodes of a binary
tree in the external node becomes

a) Internal nodes
b) External nodes
c) Root nodes
d) None
ANSWER: A
26

16. If n numbers are to be sorted in ascending order in O(nlogn) time, which of the
following tree can be used

a) Binary tree
b) Binary search tree
c) Max-heap
d) Min-heap
ANSWER: D

17. If n elements are sorted in a binary search tree. What would be the asymptotic
complexity to search a key in the tree?

a) O(1)
b) O(logn)
c) O(n)
d) O(nlogn)
ANSWER: C

18. If n elements are sorted in a balanced binary search tree. What would be the asymptotic
complexity to search a key in the tree?

a) O(1)
b) O(logn)
c) O(n)
d) O(nlogn)
ANSWER: B

19. The minimum number of elements in a heap of height h is

a) 2h+1
b) 2h
c) 2h -1
d) 2h-1
ANSWER: B

20. The maximum number of elements in a heap of height h is

a) 2h+1 -1
b) 2h
c) 2h -1
d) 2h -1
ANSWER: A

21. A threaded binary tree is a binary tree in which every node that does not have right
child has a thread to its

a) Pre-order successor
27

b) In-order successor
c) In-order predecessor
d) Post-order successor
ANSWER: B

22. In which of the following tree, parent node has a key value greater than or equal to the
key value of both of its children?

a) Binary search tree


b) Threaded binary tree
c) Complete binary tree
d) Max-heap
ANSWER: D

23. A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is

a) log2n
b) n-1
c) n
d) 2n
ANSWER: B

24. A binary search tree is generated by inserting in order the following integers:
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24

The number of the node in the left sub-tree and right sub-tree of the root, respectively, is

a) (4, 7)
b) (7, 4)
c) (8, 3)
d) (3, 8)
ANSWER: B

B and B+ Trees
1. Consider a B+-tree in which the maximum number of keys in a node is 5. What is the minimum
number of keys in any non-root node?

A1
B2
C3
D4
ANSWER: B
28

2. Which one of the following is a key factor for preferring B-trees to binary search trees for indexing
database relations?
A Database relations have a large number of records
B Database relations are sorted on the primary key
C B-trees require less memory than binary search trees
D Data transfer form disks is in blocks.
ANSWER: D

3. B+ trees are preferred to binary trees in databases because


A Disk capacities are greater than memory capacities
B Disk access is much slower than memory access
C Disk data transfer rates are much less than memory data transfer rates
D Disks are more reliable than memory
ANSWER: B

4. Which of the following is FALSE about B/B+ tree


A B/B+ trees grow upward while Binary Search Trees grow downward.
B Time complexity of search operation in B/B+ tree is better than Red Black Trees in general.
C Number of child pointers in a B/B+ tree node is always equals to number of keys in it plus one.
A B/B+ tree is defined by a term minimum degree. And minimum degree depends on hard disk
D
block size, key and address sizes.
ANSWER: B

5. A B-tree of order 4 is built from scratch by 10 successive insertions. What is the maximum number
of node splitting operations that may take place?
A3
B4
C5
D6
ANSWER: C
29

6. The order of a leaf node in a tree B+ ? is the maximum number of (value, data record pointer) pairs
it can hold. Given that the block size is 1K bytes, data record pointer is 7 bytes long, the value field is
9 bytes long and a block pointer is 6 bytes long, what is the order of the leaf node?
A 63
B 64
C 67
D 68
ANSWER: A

7. The order of an internal node in a B+ tree index is the maximum number of children it can have.
Suppose that a child pointer takes 6 bytes, the search field value takes 14 bytes, and the block size is
512 bytes. What is the order of the internal node?
A 24
B 25
C 26
D 27
ANSWER: C

8. Consider the following 2-3-4 tree (i.e., B-tree with a minimum degree of two) in which
each data item is a letter. The usual alphabetical ordering of letters is used in constructing
the tree.

What is the result of inserting G in the above


tree?

A)
30

B)

C)

D) None of the above


AA
BB
CC
DD
ANSWER: B

9. A B+ -tree index is to be built on the Name attribute of the relation STUDENT. Assume that all
student names are of length 8 bytes, disk block are size 512 bytes, and index pointers are of size 4
bytes. Given this scenario, what would be the best choice of the degree (i.e. the number of pointers
per node) of the B+ -tree?
A 16
B 42
C 43
D 44
ANSWER: A

10. With reference to the B+ tree index of order 1 shown below, the minimum number of nodes
(including the root node) that must be fetched in order to satisfy the following query: “Get all
31

records with a search key greater than or equal to 7 and less than 15” is ________

A4
B5
C6
D7
ANSWER: B

11. Consider B+ tree in which the search key is 12 bytes long, block size is 1024 bytes, record pointer is
10 bytes long and block pointer is 8 bytes long. The maximum number of keys that can be
accommodated in each non-leaf node of the tree is
A 49
B 50
C 51
D 52
ANSWER: B

UNIT-IV

MCQs on Graphs with answers

1. Which of the following is an advantage of adjacency list representation over adjacency matrix
representation of a graph?
A In adjacency list representation, space is saved for sparse graphs.
DFS and BSF can be done in O(V + E) time for adjacency list representation. These operations
B take O(V^2) time in adjacency list representation. Here is V and E are number of vertices and
edges respectively.
C Adding a vertex in adjacency list representation is easier than adjacency matrix representation.
D All of the above
32

ANSWER: D

2. The degree sequence of a simple graph is the sequence of the degrees of the nodes in the graph in
decreasing order. Which of the following sequences can not be the degree sequence of any graph? I.
7, 6, 5, 4, 4, 3, 2, 1 II. 6, 6, 6, 6, 3, 3, 2, 2 III. 7, 6, 6, 4, 4, 3, 2, 2 IV. 8, 7, 7, 6, 4, 2, 1, 1
A I and II
B III and IV
C IV only
D II and IV
ANSWER: D

3. The time complexity of computing the transitive closure of a binary relation on a set of n elements is
known to be:
A O(n)
B O(nLogn)
C O(n ^ (3/2))
D O(n^3)
ANSWER: D

4. The most efficient algorithm for finding the number of connected components in an
undirected graph on n vertices and m edges has time complexity. (A) (n) (B) (m) (C)
(m + n) (D) (mn)
AA
BB
CC
DD
ANSWER: C

5. Consider an undirected unweighted graph G. Let a breadth-first traversal of G be done


starting from a node r. Let d(r, u) and d(r, v) be the lengths of the shortest paths from r
to u and v respectively, in G. lf u is visited before v during the breadth-first traversal,
which of the following statements is correct?
A d(r, u) < d (r, v)
B d(r, u) > d(r, v)
C d(r, u) <= d (r, v)
33

D None of the above


ANSWER: C

6. How many undirected graphs (not necessarily connected) can be constructed out of a given set V=
{V 1, V 2,…V n} of n vertices ?
A n(n-l)/2
B 2^n
C n!
D 2^(n(n-1)/2)
ANSWER: D

7. Which of the following statements is/are TRUE for an undirected graph? P: Number of odd degree
vertices is even Q: Sum of degrees of all vertices is even
A P Only
B Q Only
C Both P and Q
D Neither P nor Q
ANSWER: C

8. Consider an undirected random graph of eight vertices. The probability that there is an edge
between a pair of vertices is 1/2. What is the expected number of unordered cycles of length three?
A 1/8
B1
C7
D8
ANSWER: C

9. Given an undirected graph G with V vertices and E edges, the sum of the degrees of all vertices is
AE
B 2E
CV
D 2V
34

ANSWER: B

10. How many undirected graphs (not necessarily connected) can be constructed out of a given set V =
{v1, v2, ... vn} of n vertices?
A n(n-1)/2
B 2n
C n!
D 2n(n-1)/2

ANSWER: D

UNIT-V

MCQs on Hash with answers

1. A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and
linear probing. After inserting 6 values into an empty hash table, the table is as shown
below.

Which one of the following choices gives a possible order in which the key values could have
been inserted in the table?
A 46, 42, 34, 52, 23, 33
B 34, 42, 23, 52, 33, 46
C 46, 34, 42, 23, 52, 33
35

D 42, 46, 33, 23, 34, 52


ANSWER: C

2. How many different insertion sequences of the key values using the same hash function and linear
probing will result in the hash table shown above?
A 10
B 20
C 30
D 40
ANSWER: C

3. The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of
length 10 using open addressing with hash function h(k) = k mod 10 and linear probing.
What is the resultant hash table?

AA
BB
CC
DD
ANSWER: C

4. Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7.
Assuming the hash table is initially empty, which of the following is the contents of the table when
the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an
empty location in the table.
36

A 8, _, _, _, _, _, 10
B 1, 8, 10, _, _, _, 3
C 1, _, _, _, _, _,3
D 1, 10, 8, _, _, _, 3
ANSWER: B

5. Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash
function x mod 10, which of the following statements are true? i. 9679, 1989, 4199 hash
to the same value ii. 1471, 6171 has to the same value iii. All elements hash to the same
value iv. Each element hashes to a different value.
A i only
B ii only
C i and ii only
D iii or iv
ANSWER: C

6. Consider a hash table with 100 slots. Collisions are resolved using chaining. Assuming simple
uniform hashing, what is the probability that the first 3 slots are unfilled after the first 3 insertions?
A (97 × 97 × 97)/1003
B (99 × 98 × 97)/1003
C (97 × 96 × 95)/1003
D (97 × 96 × 95)/(3! × 1003)
ANSWER: A

7. Which one of the following hash functions on integers will distribute keys most uniformly over 10
buckets numbered 0 to 9 for i ranging from 0 to 2020?
A h(i) =i2 mod 10
B h(i) =i3 mod 10
C h(i) = (11 ∗ i2) mod 10
D h(i) = (12 ∗ i) mod 10
ANSWER: B

8. Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is __________
37

A 80
B 0.0125
C 8000
D 1.25
ANSWER: A

University Question Papers

Tutorial Sheet

Unit-I
Topics Revised Date:
38

Quick Test Topics Date:

Unit-II
Topics Revised Date:

Quick Test Topics Date:

Unit-III
Topics Revised Date:
39

Quick Test Topics Date:

Unit-IV
Topics Revised Date:

Quick Test Topics Date:

Case Study Discussed Date:

Unit-V
40

Topics Revised Date:

Quick Test Topics Date:

TOPICS BEYOND SYLLABUS

Unit – 1

1.

2.

3.

4.

Unit – 2
41

1.

2.

3.

4.

Unit – 3

1.

2.

3.
4.

Unit – 4

1.

2.

3.

4.

Unit – 5

1.

2.

3.

4.

ASSESMENT OF LEARNING OBJECTIVES AND OUT COMES: DIRECT


42

Blooms Taxonomy:
LEVEL 1 REMEMBERING Exhibit memory of previously learned material
by recalling facts, terms, basic concepts, and
answers
LEVEL 2 UNDERSTANDING Demonstrate understanding of facts and ideas
by organizing, comparing, translating,
interpreting, giving descriptions, and stating
main ideas.
LEVEL 3 APPLYING Solve problems to new situations by applying
acquired knowledge, facts, techniques and rules
in a different way
LEVEL 4 ANALYZING Examine and break information into parts by
identifying motives or causes. Make inferences
and find evidence to support generalizations.
LEVEL 5 EVALUATING Present and defend opinions by making
judgments about information, validity of ideas,
or quality of work based on a set of criteria.
LEVEL 6 CREATING Compile information together in a different way
by combining elements in a new pattern or
proposing alternative solutions.

S.No. Hall I-Internal Assignment Remarks II- Assignment Remark Avg


Ticket Marks Marks & Internal Marks s& .
Number Blooms Marks Blooms Ma
Taxonom Taxono rks
y my
Assessme Assessm
nt ent
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
43

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
44

ASSESMENT OF LEARNING OBJECTIVES AND OUT COMES: INDIRECT

Blooms Taxonomy:
LEVEL 1 REMEMBERING Exhibit memory of previously learned material
by recalling facts, terms, basic concepts, and
answers
LEVEL 2 UNDERSTANDING Demonstrate understanding of facts and ideas
by organizing, comparing, translating,
interpreting, giving descriptions, and stating
main ideas.
LEVEL 3 APPLYING Solve problems to new situations by applying
acquired knowledge, facts, techniques and rules
in a different way
LEVEL 4 ANALYZING Examine and break information into parts by
identifying motives or causes. Make inferences
and find evidence to support generalizations.
LEVEL 5 EVALUATING Present and defend opinions by making
judgments about information, validity of ideas,
or quality of work based on a set of criteria.
LEVEL 6 CREATING Compile information together in a different way
by combining elements in a new pattern or
proposing alternative solutions.

CSP Rubric
S.N Criteria
LEVEL ( Level : 3-Excellent Level :2-Good Level : 1-Poor
0
Communication

Student speaks in phase with the given topic confidently using Audio-Visual aids.
3
Vocabulary is good
Student speaking without proper planning, fair usage of Audio-Visual aids.
Oral

1 2
Vocabulary is not good
Student speaks vaguely not in phase with the given topic. No synchronization
1
among the talk and Visual Aids
Proper structuring of the document with relevant subtitles, readability of document
3 is high with correct use of grammar. Work is genuine and not published anywhere
Writing Skills

else
2 Information is gathered without continuity of topic, sentences were not framed
2
properly. Few topics are copied from other documents
Information gathered was not relevant to the given task, vague collection of
1
sentences. Content is copied from other documents
Social and

3 Student identifies most potential ethical or societal issues and tries to provide
3
Ethical

solutions for them discussing with peers


2 Student identifies the societal and ethical issues but fails to provide any solutions
discussing with peers
45

Awarenes
1 Student makes no attempt in identifying the societal and ethical issues

s
Content Knowledge 3 Student uses appropriate methods, techniques to model and solve the problem
accurately
2 Student tries to model the problem but fails to solve the problem
4 1 Student fails to model the problem and also fails to solve the problem
Participation

3 Listens carefully to the class and tries to answer questions confidently


Student

2 Listens carefully to the lecture but doesn’t attempt to answer the questions

5
1 Student neither listens to the class nor attempts to answer the questions
Practical Knowledge Technical and analytical Skills

The program structure is well organized with appropriate use of technologies and
3 methodology. Code is easy to read and well documented. Student is able to
implement the algorithm producing accurate results
Program structure is well organized with appropriate use of technologies and
2 methodology. Code is quite difficult to read and not properly documented. Student
6 is able to implement the algorithm providing accurate results.

Program structure is not well organized with mistakes in usage of appropriate


1 technologies and methodology. Code is difficult to read and student is not able to
execute the program

3 Independently able to write programs to strengthen the concepts covered in theory


Independently able to write programs but not able to strengthen the concepts
2
learned in theory
7 Not able to write programs and not able to strengthen the concepts learned in
theory
1

Student uses appropriate methods, techniques to model and solve the problem
3
accurately in the context of multidisciplinary projects
Student tries to model the problem but fails to solve the problem in the context of
2
8 multidisciplinary projects
Student fails to model the problem and also fails to solve the problem in the context
1 of multidisciplinary projects
46

Understanding of Engineering core

CSP Rubric Name & Number:

S.No. Hall Ticket Rubric Assessment Blooms Taxonomy Remarks


Number Assessment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
47

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

Remedial Classes:

Unit Number Date Conducted Topics Revised


Unit-I
Unit-II
Unit-III
Unit-IV
Unit-V
48

Add-on Programmes:
1

Guest Lectures:

1.
2.
3.
4.

Unit Wise PPT’s:

Unit Wise lecture Notes:

You might also like