Data Structure
and Algorithms
▪Data Structures
Objectives ▪Algorithms
Course Description
▪Covers design, analysis and implementation of basic
data structures
▪Algorithms operating on data structures are also
covered.
▪Asymptotic analysis of algorithms and data
structures are also covered.
Course Contents
⮚Introduction to Data Structures
⮚Linked Lists
⮚Stacks & Queues
⮚Non-linear Data Structures
⮚Algorithms (Searching & Sorting)
⮚ [Linear Search, Binary Search], [Bubble sort, Selection sort, insertion sort]
⮚ [Hashing], [Quick Sort, Heap Sort, Merge Sort]
⮚Trees & Graphs
Prerequisite and assessment
⮚Fundamentals of computer science
⮚Assessment:
Mid Exam – 20%
Lab Exam – 20%
Assignment – 10%
Final Exam – 50%
Syllabus Programming Languages
▪Either Java or Python can be used for practice and exam.
▪Classes will be conducted using Java
▪IDEs: Eclipse or NetBeans are fine.
▪Data Structures and Algorithms are independent of any
programming language.
▪Data structure and algorithms are general programming concepts
and once you are familiar with concepts you can work in any
language.
Syllabus Reading
⮚ We will not have a single book, instead we will use
many books, websites, tutorials
⮚ Books
⮚ Data Structures and Algorithms in Java, 2nd edition, Robert Lafore
⮚ Data Structures and Algorithms in Java, 6th edition, Michael T. Goodrich, Roberto Tamassia, Michael H.
Goldwasser
⮚ Data Structures and problem Solving in Java, 4th edition, Mark Allen Weiss
⮚ Data Structures and Algorithms in Python, Michael T. Goodrich, Roberto Tamassia, Michael H.
Goldwasser
⮚ Data Structures and Algorithms Made easy in Java, Narasimha Karumanchi
Syllabus -warning
⮚ If you don’t do the labs
⮚ The assignments will be very hard
⮚ The exams will be very hard
⮚ You will not be able to work on your project
⮚ Copying labs, project and the assignments will result
in –ve value ☺
DSA Lab 0 - Installation
⮚ Installing (For Java users)
⮚ Java (newest JDK preferred)
⮚ Eclipse / NetBeans
⮚ Installing (For Pythonians)
⮚ VS code or PyCharm or Thonny
⮚Running
⮚ Manipulating Arrays
Introduction to Data Structures
• Discussion points:
Variables
Data Types
OOP Concepts (Object, class, inheritance, abstraction, inheritance, polymorphism, interface)
Data Structures
• Data structure is a particular way of storing and organizing data in a computer
so that it can be used efficiently.
• It’s a special format for organizing and storing data.
• A data structure is an arrangement of data in a computer’s memory (or
sometimes on a disk).
• Data structures include
• arrays,
• linked lists,
• stacks,
• binary trees, and hash tables, among others.
• Algorithms manipulate the data in these structures in various ways, such as
searching for a particular data item and sorting the data.
Abstract Data Types(ADTs)
▪ Abstract Data Type: is an abstraction of a data structure which provides only
the interface to which a data structure must adhere to.
The interface does not give any specific details about how something should be
implemented or in what programming language.
E.g., ADT vs Implementation
List 🡪 Dynamic array or linked list
Queue 🡪 Linked List, Array, Stack
Map 🡪 Tree Map, Hash Map or Hash Table
▪Roughly speaking, it’s a way of looking at a data structure: focusing on what it
does and ignoring how it does its job
What is a Data Structure in Java?
▪Data structure refers to a data collection with well-defined operations and
behavior or properties.
▪A data structure is a unique way of storing or organizing the data in computer
memory so that we can use it effectively.
▪A data structure is an arrangement of data in a computer’s memory (or
sometimes on a disk).
DS types
▪Based on the organization of elements,
Linear Data Structures –
Elements are accessed in a sequential order
Non-linear Data Structures –
▪ Elements are accessed in a non-linear order
Algorithms
▪a finite sequence of instructions, each of which has a clear meaning and can be
performed with a finite amount of effort in a finite length of time
▪Engineers use pseudocodes to first draft and describe algorithms
“somewhere between formatted English and computer program code”
Fundamental questions about algorithms
▪What is it supposed to do? [specification]
▪Does it really do what it is supposed to do? [verification]
▪How efficiently does it do it? [performance analysis | efficiency]
▪It takes a set of input(s) and produces the desired output.
For example:
An algorithm to add two numbers:
1. Take two number inputs
2. Add numbers using the + operator
3. Display the result
Examples of algorithms
▪Searching algorithms
▪Sorting algorithms
Types of notations for time complexity