0% found this document useful (0 votes)
104 views16 pages

Course Handout

Uploaded by

rohanbhoffverma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views16 pages

Course Handout

Uploaded by

rohanbhoffverma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

KALINGA INSTITUTE OF INDUSTRIAL TECHNOLOGY

Deemed to be University
BHUBANESWAR-751024

School of Computer Engineering


Autumn Semester 2019-20

Course Handout
1. Course code : CS 2001
2. Course Title : Data Structure and Algorithms
3. LTP Structure :
L T P Total Credit
3 1 0 4 4

4. Course Coordinator : Dr. Satarupa Mohanty


5. Class Teacher : Mr. Rajat Kumar Behera
6. Section : CS-08
7. Course offered to the School : Computer, Electronic and Electrical Engineering
8. Course Objective:

 Understand different ways to represent different kinds of data.


 Learn different kinds of operation performed on different representation of data.
 Identify and apply the appropriate data structure and algorithm for a specified application.
 Analyse the performance of algorithm for different operation performed on data.
 Provide solid foundations in foundational aspects of programming – both data structures and
algorithms
 Demonstrate the correctness of the algorithm and analyse their computational complexities

9. Course Outcome:
CO # Detail
CO1 Students will be able to understand the concepts of data structure, data type and
abstract data type (ADT) and compute the complexity of different algorithms.
CO2 Students will be able to understand, distinguish and implement Array and Linked list
data structure on different types of problems.
CO3 Students will be able to understand and implement different linear data structures such
as Stack and Queue to solve various problems.
CO4 Students will be able to understand and implement different non-linear data structures
such as Tree and Graph on various computing problems.
CO5 Students will be able to understand and apply standard algorithms for searching, sorting
and hashing.
CO6 Students will be able to effectively choose the data structure that efficiently models the
Information in a problem.
8. Course Contents
The course focuses on basic and essential topics in data structures and algorithms, including
arrays, linked lists, Stacks, Queues, Trees, sorting algorithms, searching algorithms and graphs.
Sr# Major Area Detailed Area
1 Introduction Structures and Unions, Pointers, Dynamic Memory Allocation,
Algorithm Specification, Space and Time Complexity
2 Arrays Arrays, Abstract Data Type, Dynamically Allocated Arrays,
Polynomials, Two-dimensional Array, Address Calculation, Matrix
Addition and Multiplication, Sparse Matrix, Upper & Lower
Triangular Matrix, Tridiagonal Matrix
3 Linked List Singly Linked Lists and Chains, Representing Chains in C,
Polynomials, Sparse Matrix, Doubly Linked Lists, Circular &
Header Linked lists
4 Stacks and Queues Stacks, Stacks using Dynamic Arrays and Linked List, Queues,
Queue using Dynamic Arrays and Linked List, Circular Queues
using Dynamic Arrays and Linked List, Evaluation of Expressions,
Priority Queue, Dequeue
5 Trees Introduction, Binary Trees, Binary Tree Traversals, Threaded
Binary Trees, Binary Search Trees, AVL Trees, m-way Search
Trees, B-Trees, Introduction to B+-Trees, Tree Operation, Forests
6 Graphs Graph ADT, Graph Operation – DFS, BFS
7 Sorting Insertion Sort, Quick Sort, Merge Sort, Heap Sort, Bubble Sort,
Selection Sort, Radix Sort
8 Searching Linear Search, Binary Search, Hashing – Hash Function, Collision
Resolution Techniques
9. Text Book:

T1. Fundamentals of Data Structures in C, 2nd Edition, Horowitz, Sahani Anderson-Freed, Universities
Press. Pearson, 1st Edition

10. Reference Books:


RB1. Data Structures, Schaum’s OutLines, Seymour Lipschutz, TATA McGraw Hill

RB2. Data Structures using C by Aaron M. Tenenbaum, Yedidyah Langsam, Moshe J.


Augenstein. Pearson, 1st Edition
RB3. Data Structures A Pseudocode Approach with C, 2nd Edition, Richard F. Gilberg,
Behrouz Forouzan, CENGAGE Learning, India Edition
RB4. Data Structures Using C, Second Edition, Reema Thereja, Oxford University Press

RB5. Data Structures and Algorithm Analysis in C, Mark Allen Weiss, Pearson Education,
2nd Edition.
11. Reference Site:

RS1. NPTEL - [Link]


RS2. Tutorials Point - [Link]
RS3. Geeks for geeks - [Link]

12. Pre-requisites:

 Programming in C (CS-1001)
 Mathematics for Computer Science
13. The day-wise course coverage depicts the provisional date of covering individual topics of the
DS&A subject in the academic session of autumn 2019-2020.
Lecture Unit Topics
No. Lesson #

1-4 Introduction  Introduction


8/7/19
 Course Coverage
 Structure, Union
 Pointers and Dynamic Memory 9/7/19
Allocation (DMA)
 Algorithm Specification
10/7/19
 Algorithm Analysis
 Time Complexity
 Space Complexity 12/7/19
 Class Work
5-9 Arrays  Array Introduction
 Row major order and address
calculation 15/7/19
 Pointers to array, Pointer to
structure, Array of pointers
 Difference between static and
dynamic memory allocation
 DMA – 1-D and 2-D arrays
 Problem Solving 16/7/19
 Array abstract data type (ADT)
 Problem Solving

 Polynomial & its Operation


17/7/19
 Matrix Operation
 Sparse Matrix and its Operation
19/7/19
 Class Work
 Tutorial Class 22/7/19
10-17 Linked List  Introduction to Linked List
 Advantages, Disadvantages,
Application
23/7/19
 Types of Linked List
 Representation
 Class Work
 Single Linked List Operation –
Traversal, Insertion, Deletion,
24/7/19
Insert Last, Delete Last
 Class Work
 Double Linked List Operations
26/7/19
 Class Work
Lecture Unit Topics
Lesson #
No.
 Circular Linked List Operations
 Class Work 29/7/19

 Header Linked List & operation


 Circular Header Linked List & 30/7/19
operation
 Polynomial
31/7/19
 Double Linked List & operation
 Sparse Matrix
2/8/19
 Class Work
 Tutorial Class
5/8/19
 Assignment -1 submission
18-25 Stacks &  Introduction to Stack
Queues  Stack Application 6/8/19
 Stack Representation – Arrays
 Stack Representation –
Linked List 7/8/19
 Stack ADT
 Arithmetic Expression Evaluation
 Class Work 9/8/19

 Arithmetic Expression
Conversion 13/8/19
 Class Work
 Introduction to Queues
 Queues Application
14/8/19
 Queues Representation – Arrays
 Assignment -2 submission
 Queues Representation – Linked
List
16/8/19
 Queues ADT
 Class Work
 Linear Queue Drawback
 Circular Queues 19/8/19

 Deques
 Priority Queue 20/8/19
 Class Work
 Class Test - Quiz 1
21/8/19
 Doubt clearing
26-37 Trees  Introduction to Trees
 Trees Terminology 4/9/19
 Class Work
 Tress Application
 Binary Tree – Full, Complete and
Extended Binary Trees 6/9/19
 Expression Trees
 Class Work
 Representation of Binary Tree –
Linked and Array Representation 10/9/19
 Binary Tree ADT
 Arithmetic Expression
Conversion 11/9/19
 Class Work
 Binary Tree Traversal Concept
and Algorithm – In-Order, Pre-
Order and Post-Order & Level- 13/9/19
Order
 Binary Tree Construction with
Lecture Unit Topics
No. Lesson #

different traversal
 Class Work on Binary Tree
 Threaded Binary Tree – Single 16/9/19
and Double Threaded
 Binary Search Tree
17/9/19
 BST ADT – Search, insertion
 BST ADT – Deletion,
18/9/19
 Class Work
 Balanced Binary Tree
 AVL Tree 20/9/19
 AVL Rotation Techniques, ADT
 Multi-way Search Tree & ADT
23/9/19
 B-Tree & ADT
 B+ Tree Introduction
24/9/19
 Forest
 Tutorial Class
25/9/19
 Assignment – 4 submission
38-40 Graphs  Introduction to Graph
 Graph Terminology 27/9/19
 Graph Application
 Graph Representation
30/9/19
 Class Work
 Graph Operation – DFS and BFS
 Class Work 1/10/19

 Class Discussion
 Quiz – 2 4/10/19

41-43 Sorting  Bubble Sort


 Insertion Sort 14/10/19
 Selection Sort
 Quick Sort
 Merge Sort 15/10/19

 Heap Sort
 Radix Sort 16/10/19

 Assignment – 5 submission
 Class Discussion 18/10/19
44-47 Searching  Linear Search
21/10/19
 Binary Search
 Hashing – Hash Function
22/10/19
 Class Work
 Hashing – Collision Resolution
Technique 23/10/19
 Class Work
 Tutorial Class 25/10/19
48-52 Mini Project  Mini Project Evaluation 28/10/19,
29/10/19,
30/10/19,
1/11/19
53-62 Discussion  Doubt clearing 4/11/19,
5/11/19,
6/11/19,
8/11/19,
11/11/19,
13/11/19,
15/11/19,
18/11/19,
19/11/19
14. Assessment Components:
Sr # Assessment Time Weightage/ Date Course Lecture No. Mode
Component Marks
From To
1 Mid-Semester 1.5 Hrs 20 3rd Sept – 1 22 Closed Book
Examination 8th Sept
2 Activity based Through 30 Throughout NA NA Open Book,
Teaching and out semester Closed Book
Learning semester and
Presentation
3 End-Semester 3 Hrs 50 26th Nov – 1 49 Closed Book
Examination 12th Dec

Mid-semester question paper comprises of 5 questions and students have to answer any four questions including
question no 1, which is compulsory. Weightage for each question is 5. There will be 5 parts in question no 1.

End-semester question paper comprises of 8 questions and students have to answer any six questions including
question no 1, which is compulsory. Weightage for 1 st question is 10 and 8 for others. There will be 10 parts in
question no 1.
15. Assessment plan for active learning activities:
Considering the guidelines circulated and after discussing with the faculty members, following activity
based teaching and learning is proposed:
Activity List
Component wise distributions of the activities are listed below.
Problem Solving Critical Thinking Quiz
15 10 5
Considering the guidelines circulated and after discussing with the faculty members, following
component wise description of each activity list is proposed:
15.1Problem solving (15 marks): Assignment
Assignments have to be solved in a group/individual and mentioned below for reference only. Faculties
are free to give their own assignments and evaluation is to be done by respective assigned subject teacher.
Subject teacher have to decide the number of groups and students for each group. Students are expected
to write the solution in the writing pad and submit the soft copy to the subject teacher.
Assignment-1 (Introduction)
 Find the time complexity of the following code segment
Q.
for (i = 1; i <= n; i = i*2)
{
for (j = n; j >= 1; j = j/2) { some statement }
}

Q.
for (i = 1; i <= n; i = i*2)
{
for (j = n; j >= 1; j = j/2) { some statement }
}
Q.
for (i = 1; i <= n; i = i*2)
{
for (j = n; j >= 1; j = j/2) { some statement }
}
 Write an recursive algorithm to print from 1 to n (where n > 1)
 Write an recursive algorithm to find the kth smallest element of a set S
 Write an recursive algorithm to sum the list of numbers
 Find the time and space complexity of the following code segment
Q.
int Factorial (int n) {
if n == 0 then
return 0;
else
return n * Factorial(n – 1)
}
Q.
int Fib(int n)
{
if n <= 1 then
return 1;
else
return Fib(n-1) + Fib (n – 2)
}

Q.
int GCD(int x, int y)
{
if y == 0 then
return x
else if x >= y AND y > 0
return GCD (y, x % y)
else
return 0;
}
 What are the operations can be performed on various data structure?
 What are the advantages of using ADT?
 Explain Top-Down and Bottom-Up approach in designing the algorithm
 Explain little o and little omega (w) notation.
 In how many ways can you categorize data structures? Explain each of them.
 What do you understand by time–space trade-off?
 Explain the criteria that you will keep in mind while choosing an appropriate algorithm to solve a
particular problem.
 Discuss the significance and limitations of the Big O notation.
 Design an algorithm whose worst case time complexity is O(m + n log n)
 Design an algorithm whose worst case time complexity is O(m + n2 log m)
 Design an algorithm whose worst case time complexity is O(m2+ n (log m)2)
 Write best case, worst case and average case time complexity of following categories of
algorithm –
o Constant time
o Linear time
o Logarithmic time
o Polynomial time
o Exponential time
Assignment-2 (Arrays)
 Write an algorithm to add the original sparse matrix with the transpose of the same matrix.
 Write an algorithm to multiply two sparse matrices.
 Design an efficient data structure to store data for lower and upper triangular matrix.
 Design an algorithm to convert a lower triangular matrix to upper triangular matrix.
 Design an efficient data structure to store data for tri-diagonal matrix.
 Write an algorithm that takes as input the size of the array and the elements in the array and a
particular index and prints the element at that index.
 Write down the algorithm to sort elements by their frequency.
 Write down the algorithm to add two polynomials of single variable.
 Write down the algorithm to multiply two polynomials of two variables.
 A program P reads in 500 random integers in the range [0..100] presenting the scores of 500
students. It then prints the frequency of each score above 50. What would be the best way for P to
store the frequencies?
 Write down the algorithm to delete all the vowels in a character array.
 Write down the algorithm to print all the elements below the minor diagonal in a 2-D array.
 Write an algorithm to find a triplet that sum to a given value
 Given an array arr, write an algorithm to find the maximum j – i such that arr[j] > arr[i]
 Write an algorithm to replace every element in the array with the next greatest element present in
the same array.
Assignment-3 (Linked List)
 Design algorithm/develop pseudocode/write C code to add a given value K to each element in the
LIST.
 Design algorithm/develop pseudocode/write C code to deletes the last node from the LIST.
 Design algorithm/develop pseudocode/write C code to delete the 1st node from the list.
 Design algorithm/develop pseudocode/write C code which interchanges the Kth and K+1st
elements
 Design algorithm/develop pseudocode/write C code to swap nodes in a linked list without
swapping data.
 Design algorithm/develop pseudocode/write C code to reverse the nodes in a linked list.
 Design algorithm/develop pseudocode/write C code to create a linked list from a given linked list.
The new linked list must contain every alternate element of the existing linked list.
 Design algorithm/develop pseudocode/write C code to count the number of times a given key
occurs in a linked list
 Let a linked list consists of n number of nodes, where each node consists of an unique number, a
priority number(in between 1 to 5), and pointer to next node Design the algorithm/develop
pseudocode/write C code to divide the nodes into different linked list where each linked consists
of nodes having same priority.
 Design algorithm/develop pseudocode/write C code to delete n nodes after m nodes of a linked
list
 Design algorithm/develop pseudocode/write C code to check if a singly linked list is palindrome
 Design algorithm/develop pseudocode/write C code to search an element in a linked list, if found
delete that node and insert that node at beginning. Otherwise display an appropriate message.
 Design algorithm/develop pseudocode/write C code to add, subtract and multiply 2 polynomials.
 Design algorithm/develop pseudocode/write C code to delete last occurrence of an item from
linked list
 Given a singly linked list with nodes L0 -> L1 -> … -> Ln-1 -> Ln. Design the algorithm/develop
pseudocode/write C code to rearrange the nodes in the list so that the new formed list is : L0 ->
Ln -> L1 -> Ln-1 -> L2 -> Ln-2 …
Assignment-4 (Stack & Queues)
 Write an algorithm to convert an infix expression into it equivalent postfix expression. Explain
the execution of algorithm using the following expression (A+B) * C – (D * E) î (F + G + (H *
M))
 Write pseudo code to check whether a given postfix expression is correctly parenthesized
 Evaluate the postfix expression: 5 3 2 * + 7 9 /4 * 2 / - 6 + 2 –
 Write C functions for insertion, deletion, traversal operation for circular queues
 Write C functions for insertion, deletion, traversal operation for input restricted deques
 Write an algorithm to copy the data elements of one stack to other without changing the order and
without using any other data structure
 Write C functions for insertion, deletion, traversal operation for priority queues
 Write an algorithm to check for balanced parentheses (, ), {, }, [ and ] in an expression
 Write recursive pseudo code or recursive function to display the string in reverse order.
 Write an algorithm to convert postfix expression to infix expression.
 Write an algorithm to convert prefix expression to infix expression.
 We are given stack data structure, the task is to implement queue using only given stack data
structure.
 We are given queue data structure, the task is to implement stack using only given queue data
structure.
 Write an algorithm or c code segment for insertion, deletion, peek and traversal of priority queue
using dynamic arrays
 Write an algorithm or c code segment for Postfix to Infix conversion
 Write an algorithm or c code segment for Prefix to Infix conversion
 Write an algorithm or c code segment for Postfix to Prefix conversion
 Write an algorithm or c code segment for Postfix to Prefix conversion
 Write C functions for insertion, deletion, traversal operation for input restricted deques
Assignment-5 (Trees)
 A binary tree has 9 nodes. The inorder and preorder traversal of T yields the following sequence
of node. Inorder: E, A, C, K, F, H, D,B,G and Preorder: F, A, E, K, C, D, H, G, B. Draw the tree
T
 Suppose T is a binary tree. Write a recursive & non-recursive algorithm to find the number of leaf
nodes, number of nodes and depth in T. Depth of T is 1 more than the maximum depths of the
depths of the left and right subtrees of T.
 Suppose T is a binary tree. Write a recursive & non-recursive algorithm to find the height of T.
 Insert the following keys in the order to form the binary search tree J, R, D, G, T, E, M, H, P, A,
F, Q
 Insert the following keys in the order to form the binary search tree 50, 33, 44, 22, 77, 35, 60, 40
 Suppose a binary tree T is in memory. Write the pseudo code to delete all terminals or leaf nodes
in T
 Write a C function to copy the binary tree T to T’
 Suppose ROOTA points to a binary tree T1. Write the pseudo code which makes a copy T2 of the
tree T1 using ROOTB as pointer
 Write algorithm to insert and delete the nodes in B tree.
 Write a program to check whether the binary tree is a binary search tree
 Write the non-recursive function for inorder traversal, preorder traversal, and postorder traversal
of a binary tree.
 Write a function to display all the paths from root to leaf nodes in a binary tree.
 Write a programme to insert a node into BST both in recursive and non-recursive manner.
 Write a programme to display the nodes of a tree in level wise(first we need to display 0th level
node, then 1th level nodes and so on).
 Write a program to check whether a binary tree is an AVL tree.
Assignment-6 (Graphs)
Write C code snippet (function) to
 Represent the graph using Adjacency Matrix
 Represent the graph using Adjacency List
 Find if there is a path between pair of vertices in an undirected and directed graph
 Find the number of isolated vertices in an undirected graph.
 Check if a given undirected graph is a tree (an undirected graph is a tree is there is cycle and is
connected)
 Find a mother vertex in a graph. Mother is a vertex v such that all other vertices in G can be
reached by a path from v. There can be more than one mother vertices in a graph. Need to output
anyone of them.
 Detect a cycle in directed graph
 Find the bridges in the undirected graph. An edge in an undirected connected graph is a bridge if
removing it disconnects the graph

Assignment-7 (Searching & Sorting)


 Let A[1], A[2], . . . , A[n] be an array containing very large positive integers. Describe an
efficient algorithm to find the minimum positive difference between any two integers in the array.
What is the complexity of your algorithm? Explain.
 Design an efficient algorithm to sort 5 distinct keys.
 Let A = A[1], . . . , A[n] be an array of n distinct positive integers. An inversion is a pair of
indices i and j such that i < j but A[i] > A [j]. For example in the array [30000, 80000, 20000,
40000, 10000], the pair i = 1 and j = 3 is an inversion because A [1] = 30000 is greater than
A[3] = 20000. On the other hand, the pair i = 1 and j = 2 is not an inversion because A [1] =
30000 is smaller than A [2] = 80000. In this array there are 7 inversions and 3 non-inversions.
Describe an efficient algorithm that counts the number of inversions in any array. What is the
running time of your algorithm?
 We have a N (very large number of) sales records. Each record consists of the id number of the
customer and the price. There are k customers, where k is still large, but not nearly as large as N.
We want create a list of customers together with the total amount spent by each customer. That is,
for each customer id, we want to know the sum of all the prices in sales records with that id.
Design a sensible algorithm for doing this.
 What is the average and worst time complexity for insertion, deletion and access operation for the
hash table?
 Mathematically compute the worst case time complexity of binary search
15.2Critical thinking (10 marks): Mini-Project
Critical thinking process is related to demonstrating the mini-project and is the group wise activity. The
group has to submit the source code and 2 pages report capturing design aspect of the project like data
structure used, algorithm used with space and time complexity and the input and output of the project.
Following mini-projects are proposed and for reference:

Sr# Unit Problem Description


1.1. Write a menu driven program using DMA and pointers to
1 Arrays
- insert, delete and update an item at any given index.
- rotate (clock & anti-clockwise) the array by d elements
- move all odd elements to the end/beginning
- move all even elements to the end/beginning
- find the largest, smallest, mean, median and mode
The program should handle all erroneous condition.
1.2. Write a menu driven program using DMA and pointers to
- insert, delete and update an item at any given index.
- find all triplets with sum zero
- find the minimum distance between two numbers
- find the maximum distance between two numbers
- sort in the wave form i.e. arr[0] >= arr[1] <= arr[2] >=
arr[3] <= arr[4] >= …..

The program should handle all erroneous condition.


1.3. Write a menu driven program using DMA and pointers to
- input elements into 2 matrix say matrix 1 and matrix 2
- find the union of 2 matrix
- find the intersection of 2 matrix
- merge 2 matrix and
 find the number of non-repeated elements in the
merged matrix
 find the median in the merged matrix
The program should handle all erroneous condition.
2 Liked List 2.1. Write a menu driven program (covering single linked list)
to
- insert, delete, delete and update a key at beginning, end or
at any intermediate position.
- reverse the list
- partition into 2 halves
- Find the length
- Remove the duplicates
The program should handle all erroneous condition.
2.2. Write a menu driven program (covering double linked
list) to
- insert, delete and update a key at beginning, end or at any
intermediate position.
- reverse the list
- split into 2 halves
- Find the length
- Remove the duplicates
The program should handle all erroneous condition.
2.3. Write a menu driven program (covering circular single
linked list) to
- insert, delete and update a key at beginning, end or at any
intermediate position.
- find the largest, smallest element
- Remove the duplicates
- Find pairs with given sum
- Swap kth node from beginning with pth node from end
The program should handle all erroneous condition.
3 Stacks 3.1. Write a menu driven program (array based) to
- insert, delete an item.
- reverse the stack
- delete the middle most item
- sort using recursion
- remove the duplicate items
The program should handle all erroneous condition.
3.2. Write a menu driven program (linked based) to
- insert, delete an item.
- reverse the stack
- delete the middle most item
- sort using recursion
- remove the duplicate items
The program should handle all erroneous condition.
3.3. Write a menu driven program for
- infix to postfix conversion
- prefix to infix conversion
- prefix to postfix conversion
- postfix to prefix conversion
- postfix to infix conversion
The program should handle all erroneous condition.
4 Queues 4.1. Write a menu driven program (array based) to
- insert items
- delete items
- reverse the elements using recursion
- sort the elements using recursion
- rearrange the elements by interleaving the first half of the
queue with the second half of the queue.
The program should handle erroneous condition.
4.2. Write a menu driven program (linked based) to
- insert items
- delete items
- reverse the elements using recursion
- sort the elements using recursion
- rearrange the elements by interleaving the first half of the
queue with the second half of the queue.
5 Trees 5.1. Write a menu driven program (covering binary trees) to
- insert, delete items.
- in-order, pre-order, level-order and post-order traversal
- search for the specific item
The program should handle erroneous condition.
5.2. Write a menu driven program (covering binary search
trees) to
- insert, delete an item.
- in-order, pre-order, level-order and post-order traversal
- search for the specific item
The program should handle erroneous condition.
5.3. Write a menu driven program (covering binary trees) to
- insert items.
- delete items.
- find the number of nodes at a given level
- find the number of leaf nodes in the tree
- find the number of internal nodes in the tree
The program should handle erroneous condition.

5.4. Write a menu driven program (covering binary trees) to


- insert items.
- delete items.
- level order traversal
- reverse level order traversal (print from left to right, last
level first, then second last level, and so on.)
- find the total number of nodes in the tree
The program should handle erroneous condition.

6 Graph 6.1. Write a menu driven directed graph program (using


adjacency matrix) to
- insert, delete nodes and edges.
- perform BFS and DFS traversal
- search for the node and edge
The program should handle all erroneous condition.

6.2. Write a menu driven directed graph program (using


adjacency list) to
- insert, delete nodes and edges
- perform BFS and DFS traversal
- search for the node and edge
The program should handle all erroneous condition.

6.3. Write a menu driven directed graph program (using


adjacency matrix) to
- insert, delete nodes and edges.
- find the transpose of the graph. If G contains an edge (u, v)
then the transpose of G contains an edge (v, u) and vice
versa.
- Find the mother vertex, A mother vertex in a graph G = (V,
E) is a vertex v such that all other vertices in G can be
reached by a path from v.
The program should handle all erroneous condition.

6.4. Write a menu driven directed graph program (using


adjacency list) to
- insert, delete nodes and edges.
- find the transpose of the graph. If G contains an edge (u, v)
then the transpose of G contains an edge (v, u) and vice
versa.
- Find the mother vertex, A mother vertex in a graph G = (V,
E) is a vertex v such that all other vertices in G can be
reached by a path from v.
The program should handle all erroneous condition.

7 Sorting 7.1. Write a menu driven recursive program (bubble, insertion,


selection, radix and bucket) to sort the array of integers in
ascending or descending order. The program should handle all
erroneous condition.
7.2. Write a menu driven program (using static array)
- sort the elements by frequency
- count the inversion (two elements arr[i] and arr[j] form an
inversion if arr[i] > arr[j] and i < j)
- Find number of pairs (x, y) in an array such that x^y > y^x
- find the elements that are greater than half of elements in
an array.
- Sort after applying the equation ax 2 + bx +c where a, b and
c are the input to be supplied by user and x represents each
element in the array.
The program should handle all erroneous condition.
7.3. Write a menu driven recursive program (bubble, insertion,
selection, radix and bucket) to sort the array of date in
ascending or descending order. The program should handle all
erroneous condition.

8 Searching 8.1. Write a menu driven program (covering following


searching techniques) to search for an item in the array
- linear
- binary
- jump
- Interpolation
- Fibonacci
The program should handle all erroneous condition.
8.2. Write a menu driven program for hash resolution
techniques
- Linear Probing (Linear Search)
- Quadratic Probing (Nonlinear Search)
- Double Hashing (Uses two hash function)
- Closed Hashing
The program should handle all erroneous condition.
8.3. Write a menu driven program (using static arrays)
- find two smallest element whose value is closest to 0
- find the kth largest element
- find the kth smallest element
- find a pair with given difference
- find the most repeating element
The program should handle all erroneous condition.
15.3 Quiz (5 marks):

Two/Three quizzes with easy, moderate and difficulty level will be conducted at the mid and end of
semester according to the standard of GATE. Sample quiz is shown for reference only. Faculties are free
to give their own questions in the quiz. Evaluation is to be done by respective assigned subject teacher.
 Consider a linear array int array[3][2] = {{45,23},{333,21},{90,45}} in 16-bit OS and the base
address of the array is 1000 and is presented in memory as Row Major. What is the address of the
element located at the index [1][1] ___________________?
 Consider the tree arcs of a BFS traversal from a source node W in an unweighted, connected,
undirected graph. The tree T formed by the tree arcs is a data structure for computing.
(A) the shortest path between every pair of vertices.
(B) the shortest path from W to every vertex in the graph.
(C) the shortest paths from W to only those nodes that are leaves of T.
(D) the longest path in the graph
16. Unit wise Activity List:
Protocol:
 Students have to submit 5 out of 7 assignments.
 Students have to submit the mini project.
 Students have to appear at least 2 quizzes.

Unit Unit Focus Weightage Tangible Output Course


No. Area Outcome
Mapping
1 Introduction Problem 10% Scanned soft copy CO1
Solving solution document
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
2 Arrays Problem 10% Scanned soft copy CO1
Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
3 Linked List Problem 10% Scanned soft copy CO1
Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
4 Stacks & Problem 10% Scanned soft copy CO1
Queues Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
5 Trees Problem 10% Scanned soft copy CO1
Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
6 Graphs Problem 10% Scanned soft copy CO1
Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
7 Sorting Problem 10% Scanned soft copy CO1
Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet
8 Searching Problem 10% Scanned soft copy CO1
Solving solution document
Critical 30% Mini-project report CO2, CO3,
Thinking CO4, CO5, CO6
Quiz 6% Hard copy quiz CO1, CO2
answer sheet

17. Course Materials: Course Material will be provided for all topics which can be used as reference. The
material consists of –
 Lecture Notes  Home Work
 Class Work  Supplementary Reading
18. Attendance: Every student is expected to be regular (in attendance) in all lecture classes, tutorials, labs,
tests, quizzes, seminars etc and in fulfilling all tasks assigned to him / her. Attendance will be recorded and
75% attendance is compulsory.
19. Makeup:
 No make-up examination will be scheduled for the mid semester examination. However, official
permission to take a make-up examination will be given under exceptional circumstances such as
admission in a hospital due to illness / injury, calamity in the family at the time of examination.
 A student who misses a mid-semester examination because of extenuating circumstances such as
admission in a hospital due to illness / injury, calamity in the family may apply in writing via an
application form with supporting document(s) and medical certificate to the Dean of the School for a
make-up examination.
 Applications should be made within five working days after the missed examination.
20. Discussion of Mid Semester performance: Performance of the mid semester examination will be
discussed in the class room
21. Pre-end semester total marks: To be announced and discussed in the class.
22. Course Management System: SAP Portal - Is a software system designed to facilitate teachers in the
management (instructional content, assessment and documentation) of the courses for their students, both
teachers and students can monitor the system. Though usually considered as a tool and often used to
complement the face-to-face classroom.
23. Chamber consultation hour for doubts clarification: To be announced in the class.
24. Academic Dishonesty:
 It may be noted that any kind of copying/plagiarism by any student and/or malpractice in examinations
is strictly prohibited.
 In case of the violation of above the Institute will take appropriate and necessary action.
25. Notices: All notices regarding the course will be displayed on respective school notice board /school of
computer engineering/ SAP portal.

You might also like