Day 1 - Intro To DSA
Day 1 - Intro To DSA
and Algorithms
Data Structures
Algorithms
Objectives
Course Description
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.
Why Data Structures
Efficient Data Organization
Data structures provide efficient ways to organize and store data in a
computer's memory. By choosing appropriate data structures, you can optimize
the storage and retrieval of data, leading to improved performance and reduced
resource usage.
Data Manipulation
Data structures offer various operations that allow for efficient manipulation of
data. For example, searching, sorting, inserting, deleting, and updating
elements can be performed more efficiently using specific data structures
tailored to these operations.
Problem Solving
Many programming problems and real-world scenarios can be modeled and
solved more effectively using appropriate data structures. Different data
structures excel in different scenarios, and having a good understanding of
them enables you to choose the most suitable approach for a given problem.
Algorithm Design
Data structures are closely tied to algorithm design. Efficient algorithms often
rely on the appropriate use of data structures to achieve optimal time and
space complexity. Understanding data structures helps in designing and
implementing algorithms that solve problems efficiently.
Code Reusability
Performance Optimization
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.
For example: