DS Final - COURSEPACK - Integrated-Latest (25-10-23)
DS Final - COURSEPACK - Integrated-Latest (25-10-23)
SCHEME
The scheme is an overview of work-integrated learning opportunities and gets students out
into the real world. This will give what a course entails.
Practical
Practical
Tutorial
Tutorial
Theory
delivery
study
Self-
SEE
CIE
Practical 1 2
Self-study 7
Total 4 12 45 30 105 50% 50%
COURSE OVERVIEW
Data structures are one of the foundation subjects for the computer science program. This
course enables the students to understand and apply the concepts of Linear Data Structure and
Non-linear Data Structure approaches in different scenarios of information processing and
storing and organizing data in a computer's memory so that these data can be used efficiently
later. It includes identifying the issue in that particular scenario required to deal with the data
structures approaches, considering several techniques to address it, and selecting the best data
structure to store, organize, and efficiently use the stored data. In this course, Data structures
include- Array, lists, stacks, queues, trees, and graphs. The Java programming language will be
used to demonstrate the concepts discussed in the lecture, and programming problems must
be completed in Java.
PREREQUISITE COURSE
COURSE OBJECTIVE
This course will introduce students to searching and sorting as well as data structures like stack,
queue, and binary tree. Students will write many programs around these topics during this
course.
COURSEPACK |
FORMAT
BLOOM’S LEVEL OF THE COURSE OUTCOMES
INTEGRATED
Remember Understand Apply Analyse Evaluate Create
CO No.
KL1 KL 2 KL 3 KL 4 KL 2 KL 6
E2UC303B.1 √
E2UC303B.2 √
E2UC303B.3 √
E2UC303B.4 √ √
COURSEPACK |
FORMAT
PO11 Project management and finance: Demonstrate knowledge and understanding of
the computing science and management principles and apply these to one’s own work,
as a member and leader in a team, to manage projects and in multidisciplinary
environments.
PO12 Life-long learning: Recognize the need for, and have the preparation and ability
to engage in independent and life-long learning in the broadest context of technological
change.
PO10
PO11
PO12
PSO1
PSO2
COs#/ POs
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
PO9
E2UC303B.1 1 1 1 - - - - - - - - - - -
E2UC303B.2 1 - - - - - - - - - - - - -
E2UC303B.3 1 - - - - - - - - - - - - -
E2UC303B.4 2 2 2 - 2 - - - 1 - - 1 - -
COURSE ASSESSMENT
The course assessment patterns are the assessment tools used both in formative and summative
examinations.
* Passing criteria – 30% of marks to be secured in the lab exam conducted by two examiners
(one internal + one external).
COURSEPACK |
FORMAT
COURSE CONTENT
Introduction: Basic Terminology, Types and application of Data Structures, Algorithm, Efficiency
of an algorithm, Time-space trade-off and complexity, asymptotic notation.
Array: Single and Multidimensional Arrays, Representation of Arrays: Row Major Order, and Column
Major Order, Derivation of Index Formulae for 1-D,2-D, and multi-D Array, Application of arrays,
Sparse Matrices, and their representations, arithmetic operations on matrices.
Recursion: Tail recursion, Head Recursion, Nested recursion, Removal of recursion. Problem
solving using iteration and recursion with examples such as Fibonacci numbers, and Hanoi towers.
Trade-offs between iteration and recursion.
Searching & Sorting: Linear search, Binary Search, Indexed Sequential search, Hashing, Insertion
Sort, Bubble sort, Selection sort, Quick Sort, Merge Sort.
Linked lists: Introduction, Singly Linked Lists, Doubly Linked List, Circularly Linked List, Operations
on a Linked List. Insertion, Deletion, Traversal, Reversing, Application of Linked List: Polynomial
Representation, Addition and Multiplication, Generalized Linked List.
Stack: Introduction, Abstract Data Type, Primitive Stack operations: Push & Pop, Array and Linked
List Implementation of Stack, Application of Stack: Prefix and Postfix Expressions, Evaluation of
postfix expression.
Queue: Introduction, Operations on Queue: Create, Add, Delete, Full and Empty, Circular queues,
Array and linked implementation of queues, Double Ended queue, and Priority Queue.
Trees: Binary Tree and Its array and linked list representation, Strict Binary Tree, Complete Binary
Tree, Tree Traversal algorithms: In-order, Pre-order, and Post-order, level order, Constructing
Binary Tree from given Tree Traversal, BST Operation: Searching, Insertion, Deletion, Threaded
Binary Trees, Traversals in Threaded Binary Trees, Heaps, Heap Sort.
Graph-Introduction to graph, Concepts, and representation.
COURSEPACK |
FORMAT
LESSON PLAN FOR COMPREHENSIVE COURSES
FOR THEORY 15 weeks * 3 Hours = 45 Classes) (1credit = 1Lecture Hour)
FOR PRACTICAL 15 weeks * 2Hours = 30 Hours lab sessions (1 credit = 2 lab hours)
Theory /
Tutorial
L-
Topic for Delivery / Skills Competency
No
Practical
Plan
1 Basic Terminology, Types Data Structures Theory
2 Application of Data Structures Theory
th
Write a program to insert an element in i
3 position of the array.
Practical Develop
th
Write a program to delete i element of the programs by
4 array. using the array
concept and CO1
5 Algorithm, Efficiency of an algorithm Theory examining the
6 Time-space trade-off and complexity Theory temporal
Asymptotic notation Theory complexity.
7
8 Write a program to rotate an array.
Write a program to move all zeros to the Practical
9 beginning/end of an array.
COURSEPACK |
FORMAT
Write a recursive program to print an array in through
20 reverse order. Practical recursion and
change
21 Write a recursion Program to find a^b.
iterative
Problem-solving using iteration and recursion with programs
22 Theory
examples such as Fibonacci numbers into recursive
ones and vice
23 Hanoi towers Theory versa.
Develop
28 Indexed Sequential search, Hashing Theory programs for
different
Write a program to search an element in an array searching
29 using binary search. (Iteration) techniques.
Practical
Write a program to search an element in an array
30 using binary search. (recursion)
Develop
32 Quick Sort Theory programs for
different
33 Merge Sort Theory sorting
techniques.
34 Write a Program to implement bubble sort.
Practical
35 Write a Program to implement selection sort.
COURSEPACK |
FORMAT
41 Circularly Linked List Theory
COURSEPACK |
FORMAT
operations
62 Operations on Queue: Delete, Full and Empty Theory and its
applications.
Write a Program to implement a queue using an
63 array.
Practical
Write a Program to implement a queue using a
64 linked list.
Array and Linked List implementation of Queue
65 Theory
and Circular Queues
Array and Linked List implementation of Dqueue
66 Theory
and Priority Queues
Write a program to find the smallest number the
67 in queue.
Practical
Write a program to implement a Circular Queue
68 using an array.
Trees: Binary Tree, and Its array and linked list
69 Theory
representation
COURSEPACK |
FORMAT
Write a Program to implement heap sort using an
82 Practical
array.
BIBLIOGRAPHY
Text Book
1. Aaron M. Tenenbaum, Yedidyah Langsam and Moshe J. Augenstein “Data
Structures”.
2. Sahni Sartaj, “Data structures, algorithms, and applications in Java”, McGraw-Hill
Reference Books
1. Michael T. Goodrich; Roberto Tamassia; Michael H. Goldwasser; Subhasish
Banerjee “Data Structures and Algorithms in Java”, Wiley.
2. Jean Paul Trembley and Paul G. Sorenson, “An Introduction to Data Structures with
applications”, McGraw Hill
3. James Cutajar “Beginning Java Data Structures and Algorithms”, O’Reilly.
4. John Hubbard "Data Structures with Java" Schaum's Outline Series.
5. Narasimha Karumanchi "Data Structures and Algorithms Made Easy in Java"
CareerMonk
Webliography
1. https://cse.iitkgp.ac.in/~dsamanta/javads/index.htm
2. https://www.geeksforgeeks.org/data-structures/
3. https://www.javatpoint.com/data-structures-in-java
4. https://www.programiz.com/dsa
5. https://www.w3resource.com/
6. https://www.javaguides.net/p/data-structures-and-algorithms-in-java.html
SWAYAM/NPTEL/MOOCs Certification
1. Data Structure and Algorithms using Java
URL: https://archive.nptel.ac.in/courses/106/105/106105225/
2. Data Structures and Algorithms In Java (DSA)
URL: https://www.udemy.com/course/data-structures-and-algorithms-in-
java/
COURSEPACK |
FORMAT
3. Object Oriented Java Programming: Data Structures and Beyond
Specialization
URL: https://www.coursera.org/specializations/java-object-oriented
4. Introduction to Data Structures & Algorithms in Java (LinkedIn)
URL: https://www.linkedin.com/learning/introduction-to-data-structures-
algorithms-in-java
5. Data Structures and Algorithms – Self Paced (GeeksforGeeks)
URL: https://practice.geeksforgeeks.org/courses/dsa-self-paced
PRACTICE PROBLEMS:
S.No. Problems
Write a program to find the number of elements in the largest increasing sequence
1
in an array.
2 Write a program to remove duplicates from an array.
3 Write a Program to find the transpose of a matrix.
4 Write a program to find the second smallest element in a linked list.
Write a program to check whether doubly linked list elements make palindrome or
5
not.
Given an array, arr[2………11][5………20] with base value 200, and the size of each
6 element is 2 Byte in memory. Find the address of arr[7][11] with the help of row-
major order.
Given an array, arr[2:11, -3:4, 7:18] with a base value of 300 and the size of each
7 element is 3 Bytes in memory find the address of element arr[4][-2][12] with the
help of row-major order?
8 Write a program to calculate the average value of array elements.
9 Write a program to find the Middle Element of a Linked List in a single traversal.
A circular queue has a size of 5 and has 3 elements 10,20 and 40 where F=2 and
R=4. After inserting 50 and 60, what is the value of F and R. Trying to insert 30 at
10
this stage what happens? Delete 2 elements from the queue and insert 70, 80 & 90.
Show the sequence of steps with necessary diagrams with the value of F & R.
Construct an expression tree for the expression (a+b*c) + ((d*e+f)*g). Give the
11
outputs when you apply in-order, preorder, and post-order traversals.
Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) =x
12 mod 10. Prepare the results for the following: i) Open addressing hash table using
linear probing. (ii)Open addressing hah table using quadratic probing.
Write a bubble sort program with a condition that its best-case complexity will be
13
O(n).
14 Write a program to merge two sorted arrays in a single array.
15 Write a program to reverse elements of the queue using stack.
16 Write a recursive program to find the greatest common divisor of two numbers.
COURSEPACK |
FORMAT
Develop a program to merge two sorted linked lists (P & Q). Assume that they are
17
available to get a single sorted list S. Eg. P:1->2->45->56 Q:3->24->56->63->66
18 Evaluate the postfix expression 10 5 + 60 6/ * 8 -
Drive a formula to calculate the address of a 3-dimensional array in column-major
19
order.
20 Implement Queue using two stacks.
Data are pushed to (PUSH operation) and popped from (POP operation) a stack in
the following order: PUSH 3; TOP; PUSH 7; TOP; PUSH 6; PUSH 9; TOP; POP; POP;
21
TOP; where the PUSH, POP, and TOP are the standard operations of the stack.
Write the values returned by TOP for the sequence of operations above.
Let A be a square matrix of size n x n. Consider the following program. What is the
expected output?
C = 100
for i = 1 to n do
for j = 1 to n do
{
22 Temp = A[i][j] + C
A[i][j] = A[j][i]
A[j][i] = Temp – C
}
for i = 1 to n do
for j = 1 to n do
Output(A[i][j]);
Following pseudo code of a function that takes a number as an argument, and uses
a stack S to do processing. What is the expected output?
void fun(int n)
{
Stack S; // Say it creates an empty stack S
while (n > 0)
{
// This line pushes the value of n%2 to stack S
push(&S, n%2);
23 n = n/2;
}
// Run while Stack S is not empty
while (!isEmpty(&S))
printf("%d ", pop(&S)); // pop an element from S and print it
COURSEPACK |
FORMAT
Following pseudo-code of a function that takes a Queue as an argument, and uses a
stack S to do processing. What is the expected output?
void fun(Queue *Q)
{
Stack S; // Say it creates an empty stack S
// Run while Q is not empty
while (!isEmpty(Q))
{
// deQueue an item from Q and push the dequeued item to S
24
push(&S, deQueue(Q));
}
// Run while Stack S is not empty
while (!isEmpty(&S))
{
// Pop an item from S and enqueue the popped item to Q
enQueue(Q, pop(&S));
}
}
25 Write a program to reverse the number using stack.
26 Write a program to reverse a stack using recursion, without using any loop.
27 Write a program to reverse a string using stack.
Convert the following Infix expression into a Postfix expression using the Tabular
28
method. a – b / c * d + e * f / g
Write a program to find the length of the longest consecutive elements sequence
from an unsorted array of integers.
29 Sample array: [49, 1, 3, 200, 2, 4, 70, 5]
Let, the longest consecutive elements sequence is [1, 2, 3, 4, 5], therefore the
program will return its length 5.
What is the output of quick sort after the 3rd iteration given the following
30
sequence? 24 56 47 35 10 90 82 31
31 Implement two stacks in a single array.
The following postfix expression is evaluated using a Stack:
32 8 2 3 ^ / 2 3 * + 5 1 * – ^ is an exponential operator, find out the top two elements
after * on the top of the stack.
33 Write a program to get the nth element from the bottom of the stack.
34 Write a program to convert Decimal to binary using recursion.
35 Solve Tower of Hanoi problem with 5 disks and three pegs. (Show all steps)
36 Write a recursive program to find the sum of digits of given numbers.
Write a program to find all pairs of elements in an array whose sum is equal to a
37
specified number.
38 Write a program to convert binary to decimal using recursion.
39 Write a recursive method to calculate the product of all numbers in an array.
COURSEPACK |
FORMAT
Construct a MAX-HEAP tree for the following nodes: 70, 60, 50, 40, 30, 20, 5, 1, 7,
40
80, 90
How many minimum number of swap operations are needed to convert the
41 following array into the heap with maximum element at root: 89, 19, 40, 17, 12,
10, 2, 5, 11, 6, 9, 70
What would be the post-order of the tree if preorder and in-order traversals are
42
given: PREORDER: ABDECFG, INORDER: DBEAFCG
Write a program to implement a stack and move the nth element from the top of
43
the stack to the top.
A Binary Search Tree contains the following Pre-order: 5, 3, 1, 2, 4, 6, 8, 7. What
44
will be the Post-order?
Simulate the result of inserting 2, 1, 4, 5, 9, 3, 6, and 7 into an initially empty BST
45
Tree.
Write a recursive method to check whether the given array is sorted in ascending
46
order or not.
47 Write a program to check whether elements of Dequeue make palindrome or not.
48 Write a Program to implement stack using the queue data structure.
49 Write a Program to reverse Queue using recursion.
50 Write a Program to count the number of elements in a queue.
51 Write a program to check whether two trees are identical or not.
Write a program to implement Collision resolution in the Hash table using linear
52
probing.
Write a program to implement Collision resolution in the Hash table using
53
quadratic probing.
54 Write a Program to detect the Cycle in the linked list.
Write a Program to implement quick sort. (The pivot element is the middle
55
element)
56 Write a Program to implement a doubly circular queue.
57 Write a program to sort a given linked list.
58 Write a program to find the height of a tree.
Complete the code for POP out 'n' elements of the stack
static void stack_pop(Stack<Integer> stack)
{
System.out.println("Pop Operation:");
for(……………….)
59 {
Integer y = (Integer) stack.pop();
System.out.println(y);
}
COURSEPACK |
FORMAT
Correct the following code for recursive linear search in the Linked
List
public boolean search(Node head, int x)
{
// Base case
if (head == null)
return true;
60
// If the key is present in the current node,
// return true
if (head.data = x)
return false;
// Recursion for the remaining list
return search(head.next, x);
}
COURSEPACK |
FORMAT