Professional Documents
Culture Documents
(Week 1 Part 1)
What is Data Structure?
• Data structures deal with how the data is
organized and held in the memory when a
program processes it.
• In programming, we use data structures to
store and organize data, and we use
algorithms to manipulate the data in those
structures.
• DS refers to a scheme for organizing data, or in
other words a data structure is an
arrangement of data in computer's memory in
such a way that it could make the data quickly
available to the processor for required
calculations.
• A data structure should be seen as a logical
concept that must address two fundamental
concerns.
• First, how the data will be stored, and
• Second, what operations will be performed on
it?
• data structures are actually an
implementation of Abstract Data Types or
ADT.
• This implementation requires a physical view
of data using some collection of programming
constructs and basic data types.
Characteristics of Data Structures
• data structures can be divided into two
categories in computer science: primitive and
non-primitive data structures.
• The former are the simplest forms of
representing data, whereas the latter are
more advanced: they contain the primitive
data structures within more complex data
structures for special purposes.
Overview of Data Structures
Primitive Data Structures
• These are the most primitive or the basic data
structures. They are the building blocks for data
manipulation and contain pure, simple values of
a data. Python has four primitive variable types:
• Integers
• Float
• Strings
• Boolean
• Integers
You can use an integer represent numeric
data, and more specifically, whole numbers from
negative infinity to infinity, like 4, 5, or -1.
• Float
"Float" stands for 'floating point number'. You
can use it for rational numbers, usually ending
with a decimal figure, such as 1.11 or 3.14
Characteristics of Data Structures
Data Structure Advantages Disadvantages
Array Quick inserts Slow search
Fast access if index known Slow deletes
Fixed size
Ordered Array Faster search than unsorted Slow inserts
array Slow deletes
Fixed size
Stack Last-in, first-out access Slow access to other items
Queue First-in, first-out access Slow access to other items
Linked List Quick inserts Slow search
Quick deletes
Binary Tree Quick search Deletion algorithm is complex
Quick inserts
Quick deletes
(If the tree remains balanced)
Data Structure Advantages Disadvantages