Docsity

Data structure using java, Study notes of Global studies

Toggle sidebar
bg1
1
Data Structures Using Java
(SE- SEM-III)
Compiled, reviewed and edited by:
Mrs. Foram Shah
Ms. Vinitta Sunish
Dr. Preksha Pareek
Mr. Sudhir Mundra
TCET, Mumbai
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Data structure using java and more Study notes Global studies in PDF only on Docsity!

Data Structures Using Java

(SE- SEM-III)

Compiled, reviewed and edited by:

Mrs. Foram Shah

Ms. Vinitta Sunish

Dr. Preksha Pareek

Mr. Sudhir Mundra

TCET, Mumbai

STUDY MATERIAL FOR FE SEM-III

Under the guidance of Dr. B. K. Mishra, Principal 6 th^ Edition of revised syllabus, July 2026 © Thakur College of Engineering and Technology, Kandivali, Mumbai. Published by: Thakur College of Engineering and Technology

General Guidelines for Learners:

1. Resource book is for a structured and guided teaching learning process and therefore learners are

recommended to come with the same in every lecture.

2. While conducting the teaching learning process this resource book will be extensively used.

3. Resource book is framed to improve the understanding of subject matter at depth and therefore

the learners are recommended to take up all the module contents, home assignments and exercise

seriously.

4. A separate notebook should be maintained for every subject.

5. Lectures should be attended regularly. In case of absence, topics done in the class should be

referred from the module before attending the next lecture.

6. Motivation, weightage and pre‐requisite in every chapter have been included in order to maintain

continuity and improve the understanding of the content to clarify topic requirements from exam

point of view.

7. For any other additional point related to the topic instructions will be given by the subject teacher

from time to time.

Subject Related Guidelines:

1. The subject is pure as well as applied in nature and it requires thorough understanding of subject

2. Questions are expected from all modules and learners are instructed not to leave any module in

option.

3. Theory paper will be of 60 marks, Internal assessments of 20 marks, practical examination will be of

25 marks and continuous and systematic work during the term (Term work) will be of 25 Marks.

Importance should be given to term work and all internal assessment/continuous assessment for

improving overall percentage in examination.

4. Practice questions should be solved sincerely in order to enhance confidence level and to excel in

the end semester examination.

Exam Specific Guidelines:

1. All modules are equally important from an examination point of view.

2. Wherever applicable chemical reaction, mechanism and neat labeled diagram must be provided for

writing effective answers.

3. Proper time management is required for completing the question paper within a time frame.

4. Read the question paper thoroughly first then choose the questions. Attempt the one that you

know the best first but do not change the internal sequence of the sub questions.

5. For further subject clarification/ doubt in the subject, learners can contact the subject teacher.

Guidelines for Writing Quality Answer:

1. Write content as per marks distribution.

2. Highlight the main points.

3. Write necessary content related to the point.

4. Draw neat and labeled diagrams wherever necessary.

5. While writing distinguishing points, write double the number of points as per the marks given,

excluding the example.

S.E. Semester –III

Choice Based Credit Grading Scheme with Holistic and Multidisciplinary Education (CBCGS-HME 2023)

Proposed TCET Autonomy Scheme (w.e.f. A.Y. 2026-27)

B.E. ( Computer Engineering ) S.E. SEM : III Course Name : Data Structures Using Java Course Code : PCC-CS Teaching Scheme (Program Specific) Examination Scheme (Academic) Modes of Teaching / Learning / Weightage Modes of Continuous Assessment / Evaluation Hours Per Week Theory (100) Practical/Oral/ Presentation (25) Term Work (25) Total 40/20 60/ 0 Theory Tutorial Practical Contact Hours Credits IA ESE PR/OR TW 150 ISE IE 3 1 2 6 5 20 20 60 25 25 IA: In-Semester Assessment - Paper Duration – 1 Hour ESE: End Semester Examination - Paper Duration – 2/1 Hours The weightage of marks for continuous evaluation of Term work/Report: Formative (40%), Timely completion of practical (40%) and Attendance / Learning Attitude (20%) Prerequisite: Computer Basics, Object Oriented Programming Languages Course Objective: The course intends to deliver the fundamentals of data structures by providing a platform to learn, compare and apply them in real world scenario. Course Outcomes: Upon completion of the course students will be able to: Sr. No . Course Outcomes Cognitive levels of attainment as per Bloom’s Taxonomy PO Mapping PSO Mapping PI Module wise % weightage in exam 1 Discuss the use of OOPM concepts in relation to linear and non-linear. L1, L 1, 2 1 1.2.1, 1.5.1, 1.6.1, 1.7.1, 2.5.1, 2.5.2, 2.6.4, 2.8. 8 2 Experiment^ with^ fundamental operations – including insertion, deletion, searching, and traversal - on stack and queue data structures to solve computational problems. L1, L2,L3, L4 1, 2, 3, 11

1.6.1, 1.7.1, 2.5.1, 2.5.2, 2.6.4, 2.8.2, 3.6.1, 3.7.1, 3.8.2, 11.4.2, 11.6. 10 3 Illustrate^ how^ algorithms^ for^ insertion, deletion, searching, and traversal in linked list data structures support efficient memory management and effective problem solving. L1, L2,L3, L4 1, 2, 3, 11

1.6.1, 1.7.1, 2.5.1, 2.5.2, 2.6.4, 2.8.2, 3.6.1, 3.7.1, 3.8.2, 11.4.2, 11.6. 12 4 Outline^ appropriate^ techniques^ for performing insertion, deletion, searching, and traversal in tree data structures to support effective hierarchical data representation L1, L2,L3, L4 1, 2, 3, 11

1.6.1, 1.7.1, 2.5.1, 2.5.2, 2.6.4, 2.8.2, 3.6.1, 3.7.1, 12

Books and References:

Sr. No. Title Authors Publisher Edition Year 1 Data Structures with Java Johan R Hubbard Tata McGraw- Hill Second Edition 2012 2 Data Structures: A Pseudocode Approach with Java Richard F. Gilberg & Behrouz A., Forouzan CENGAGE Learning Second Edition 2011 3 Data Structures Using Java Aaron M Tenenbaum, Yedidyah Langsam, Moshe J Augenstein Pearson Second Edition 2006

Online References:

Sr. No. Website Name URL Modules Covered 1 www.w3schools.com https://www.w3schools.com/java/ M 2 www.geeksforgeeks.org https://www.geeksforgeeks.org/stack-data- structure/ M 3 www.studytonight.com https://www.studytonight.com/data- structures/introduction-to-data-structures M1- M 4 www.w3schools.in https://www.w3schools.in/category/data- structures-tutorial/ M1- M

List of Practical/ Experiments:

Practical Numb er Type of Experiment Practical/ Experiment Topic Hrs. Cognitive levels of attainmen t as per Bloom’s Taxonomy 1 A Basic Experiments Build a java program to demonstrate data types and operators in Java. 2 L1, L2, L3,L 1 B Build a java program to demonstrate control statements in Java. 2 L1, L2, L3,L 2 Build a Program for stack using an array (Menu driven program) 2 L1, L2, L3,L 3 Build a Program for Queue using an array. (Menu driven program) 2 L1, L2, L3,L 4 Design Experiments Develop a code for circular queue. (Menu driven) 2 L1, L2, L3,L 5 Develop a code for Single Linked List. (Menu driven program) 2 L1, L2, L3,L 6 Develop a code for Doubly linked list. (Menu driven program) 2 L1, L2, L3,L 7 Develop a code for Binary Search Tree (Menu driven program) 2 L1, L2, L3,L 8 Develop a code for AVL tree (Menu driven program) 2 L1, L2, L3,L 9 Develop a code for BFS. (Menu driven program) 2 L1, L2, L3,L 10 Develop a code for DFS. (Menu driven program) 2 L1, L2, L3,L 11 Advanced Experiments Develop a code for circularly linked doubly linked list. 2 L1, L2, L3,L 12 Mini/Minor Projects/ Seminar/ Case Studies Mini Project: ● Browser Navigation Simulator ● Ticket Booking Queue System ● Music Playlist Manager ● Expression Calculator ● File System Explorer (Tree- Based) ● Social Network Graph Analyzer ● Task Scheduler with Heap ● Fast Dictionary using Hashing ● Large Data Sorting Visualizer 6 L1,L2,L3,L4, L5, L Total Hours 30

List of Tutorials:

INDEX Module Contents Page No. 1. Introduction to Java: Data Types, Operators, Control structure, Array, String & vectors, classes & objects, Methods. Introduction to Data Structure : Types of data Structures, Abstract data type, Importance of ADT, Operations on data structures. 12 to 69 2. Stack: Operations on stack, array implementation of stack, applications of stack. Queue: Operations on queue, array implementation of queue, Types of queues: circular queue, priority queue, double ended queue. 70 to 106 3. Linked list: Operations on linked list, Types of linked lists: Single linked list, Double Linked list, Circular linked list, Implementation of linked list, stack implementation using linked list, queue implementation using linked list, Applications of linked list. 107 to 140 4. Trees: Terminologies, Binary tree and its types, Binary tree operations and implementation, Tree traversing techniques, Expression tree, AVL tree, B tree, B+ tree, Representing Lists as binary tree. 141 to 179 5. Graph: Terminologies, Cycles in graph, Graph representation: Matrix and Adjacency list, Graph traversing techniques: BFS, DFS, Applications of graph, Graph Application: Topological sort. 180 to 200 6. Hashing, Heap, Sort: Selection, Bubble, Insertion, Radix, Case Study (^) 201 to 206

Module- Introduction to Data Structure Motivation: To store/organize a given data in the memory of the computer so that each subsequent operation (query/update) can be performed quickly. Also to know about the object oriented programming concepts for Class and Object use. To understand the Data Types, Variables, Operators, Control Structures and many different concepts of Java Programming to make programming easier. Syllabus: Lecture Content Duration Self-Study 1 Introduction to Java 1 Lecture 1 hour 2 Data Types & Operators 1 Lecture 1 hour 3 Control Structure 1 Lecture 1 hour 4 Array 1 Lecture 1 hour 5 String & vectors 1 Lecture 1 hour 6 classes & objects, Methods 1 Lecture 1 hour 7 Types of data Structures 1 Lecture 1 hour 8 Abstract data type 1 Lecture 1 hour 9 Importance of ADT 1 Lecture 1 hour 10 Operations on data structures. 1 Lecture 1 hour Learning Objectives:

● Students shall know about Data structure basics.

● Students shall know ADT.

● Students shall be able to recall operations on DS.

Theoretical Background:

A good command on Programming in C is required. Where in it involves arrays, Recursion,

Linked lists

Course Content: Lecture 1

Java Virtual Machine (JVM): The JVM is an abstract computing machine designed to provide a runtime environment where Java bytecode can be executed. It serves as a specification that can be implemented on various hardware and software platforms, enabling Java programs to run consistently across different systems. Java Development Kit (JDK): The JDK is a comprehensive suite tailored for software developers. It includes essential tools such as the Java compiler, Javadoc, Jar, and a debugger, which are necessary for developing Java applications. Java Runtime Environment (JRE): The JRE provides the core Java libraries and components needed to run Java applications. It is designed for end-users and can be considered a subset of the JDK, focusing specifically on the execution of Java programs rather than development tools. The Four Fundamental Principles of Object-Oriented Programming:

1. Inheritance: Inheritance allows one class to inherit the properties and behaviors of another class, referred to as the parent or superclass. This promotes code reuse and can facilitate runtime polymorphism, where a subclass can override methods of its superclass.

2. Polymorphism: Polymorphism refers to the ability to perform a single action in different ways. In Java, this is achieved through method overloading (where multiple methods in the same class have the same name but different parameters) and method overriding (where a subclass provides a specific implementation of a method already defined in its superclass). 3. Abstraction: Abstraction involves hiding the internal details of an implementation and exposing only the necessary functionalities to users. In Java, abstraction is achieved using interfaces and abstract classes. For instance, when using an ATM, we interact with the machine's interface without needing to understand its internal workings, which exemplifies abstraction in everyday life. 4. Encapsulation: Encapsulation is the practice of bundling data and methods that operate on that data within a single unit, typically a class. This concept is central to Java, where classes encapsulate data and methods. For example, a JavaBean demonstrates encapsulation by keeping its data members private and providing access through public methods. This is similar to how a capsule encloses medicine, keeping its contents protected and contained. Applications of Java Programming Language: As Java evolved, it gained immense popularity due to its ability to support a variety of platforms and configurations. One of Java's most notable features is its "write once, run anywhere" capability. Over time, Java has introduced several versions, now known as Java SE (Standard Edition), Java ME (Micro Edition), and Java EE (Enterprise Edition). Here are some key applications and features of the Java programming language: Multithreading: Java simplifies the creation of applications that can perform multiple tasks simultaneously through its multithreading capabilities. This is particularly useful for developing interactive applications that require smooth, concurrent operations. High Performance: Java's architecture is optimized to minimize overhead during application execution. The Just-In-Time (JIT) compiler further enhances performance by compiling methods on demand, only when they are called, which accelerates the execution of applications. Distributed Computing: Java supports the development of distributed applications through technologies like Remote Method Invocation (RMI) and Enterprise Java Beans (EJB). These features enable Java applications to run across multiple systems connected via the internet, allowing objects on one Java Virtual Machine (JVM) to interact with those on a remote JVM. Dynamic: Compared to C and C++, Java is more dynamic. It can adapt to evolving environments by carrying a significant amount of runtime information. This flexibility allows for runtime verification of objects, making Java more adaptable and responsive to changes during execution. Hello World Program: Import java.io.*; public class Main { public static void main(String[] args)

● Java's garbage collector automatically reclaims memory from objects that are no longer referenced, aiding in efficient memory management. Additionally, the classpath is a designated file path where the Java runtime and compiler search for .class files. ● Java is utilized in various applications, including multithreaded, distributed, dynamic, and high- performance environments. Lecture 2

Data Types:

For example: int a = 5; // Integer (whole number) float b = 5.99f; // Floating point number char c = 'D'; // Character boolean d = true; // Boolean String e = "Hello"; // String

Data types are divided into two groups: ● Primitive data types - includes byte, short, int, long, float, double, boolean and char ● (^) Non-primitive data types - such as String, Arrays and Classes (you will learn more about these in a later chapter) Data Type Size Description byte 1 byte Stores whole numbers from -128 to 127 short 2 bytes Stores whole numbers from -32,768 to 32, int 4 bytes Stores whole numbers from -2,147,483,648 to 2,147,483, long 8 bytes Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775, float 4 bytes Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits double 8 bytes Stores fractional numbers. Sufficient for storing 15 decimal digits boolean 1 bit Stores true or false values char 2 bytes Stores a single character/letter or ASCII values

Operators :

Operator in Java is a symbol that is used to perform operations. For example: +, -, *, / etc.

There are many types of operators in Java which are given below:

● Unary Operator,

● Arithmetic Operator,

● Shift Operator,

● Relational Operator,

● Bitwise Operator,

● Logical Operator,

● Ternary Operator and

● Assignment Operator.

● negating an expression

● inverting the value of a boolean

Example 1:

public class Unary

public static void main(String args[])

int x=10;

System.out.println(x++);//10 (11)

System.out.println(++x);//

System.out.println(x--);//12 (11)

System.out.println(--x);//

Output:

Example 2:

public class Unary

public static void main(String args[])

int a=10;

int b=-10;

boolean c=true;

boolean d=false;

System.out.println(~a);

//-11 (minus of total positive value which starts from 0)

System.out.println(~b);//9 (positive of total minus, positive starts from 0)

System.out.println(!c);//false (opposite of boolean value)

System.out.println(!d);//true

Output:

false

true

Java Arithmetic Operators

Java arithmetic operators are used to perform addition, subtraction, multiplication, and

division. They act as basic mathematical operations.

Example 3:

public class Arithmetic

public static void main(String args[])

int a=10;

int b=5;

System.out.println(a+b);//

System.out.println(a-b);//

System.out.println(a*b);//

System.out.println(a/b);//

System.out.println(a%b);//

Output:

Java Left & Right Shift Operator

The Java left shift operator << is used to shift all of the bits in a value to the left side of a

specified number of times whereas the Java right shift operator >> is used to move the value

of the left operand to right by the number of bits specified by the right operand.

Example 4:

public class LeftShift

public static void main(String args[])

System.out.println(10<<2);//102^2=104=

System.out.println(10<<3);//102^3=108=

System.out.println(20<<2);//202^2=204=

System.out.println(15<<4);//152^4=1516=