DSA Lecture 1
DSA Lecture 1
Data Storage Data is organized in a specific format that makes it easy to access and
modify, which is where data structures come into play.
Data Types The classification of data based on the kind of values it can hold and the
operations that can be performed on it, such as integers and strings etc.
Data The associations and connections between different data elements within
Relationships a data structure, defining how they interact and relate to one another.
Data Structure is a particular way of storing and organizing data in the memory of the
computer so that these data can easily be retrieved and efficiently utilized in the future when
required.
It is a set of instructions, but not the entire program or code; it is simple logic for a problem
represented as an informal description in the form of a pseudo-code.
An Algorithm is generally created independent of underlying any programming language. You
can implement it in any programming language, such as Java, Python, C, C++, etc.
Example: Write an algorithm that inputs two numbers, calculates sum and then
displays the result on screen.
1. Start
2. Input A, B
3. Total= A+B
4. Display Total
5. Exit
Primitive Data • The Primitive Data Structures are fundamentals data types that
Structure are supported by a programming language.
• These data structures can be manipulated or operated directly
by machine-level instructions.
• Such data structures consist of basic and simple data types like
integer, float, character, etc.
Abstract Data • The Non-primitive Data Structures are derived from primitive
structure data structures. These are created by a programmer, but not
defined by a programming language.
• These data structures can't be manipulated or operated directly
by machine-level instructions.
• This type of data structure is used to store group of values in the
form of arrays, queues, stack, trees, graphs, etc.
Linear Data Structure In Linear Data Structure, the elements are arranged in a sequence.
Based on memory allocation, the Linear Data Structures are further
classified into two types:
• Static Data Structure: Fixed-size data structures have memory
allocated at compile time, and their size can't be changed
afterward, though the stored data can be modified (e.g., Array).
• Dynamic Data Structure: Dynamic data structures allocate
memory at runtime, allowing their size and stored data to change
during execution (e.g., linked list, queue, and stack).
Non-Linear Data In Non-Linear Data Structure, the data elements are not arranged in
structure a sequence.
Data insertion and removal aren’t linear; instead, there’s a
hierarchical relationship between items.
Example: Trees and Graphs.
Operation Description
Searching Find the location of the key value within the data structure.
Merging Combine elements of two different lists into single sorted list.
An array is a data structure that collects multiple data elements of the same data type under
one variable name, using index numbers (subscripts) for access. All elements are stored in
contiguous memory locations, allowing easy traversal by their indexes.
Features of an Array
Example:
Array[5]= {15,20,10,5,25}
Lower Bound:
Array[0]= 15
Upper Bound:
Array[4]= 25
score[7]={1,2,3,4,5,6,7}