Professional Documents
Culture Documents
Introduction to Data
Structures
Module 1
Joie Ann M. Mac
What is Data Structure?
array
Linked list
Types of Data Structure
• Non-Linear: The data values in this structure are not arranged in order .
• Hash tables: Unordered lists which use a ‘hash function’ to insert and search
• Tree: Data is organized in branches.
• Graph: A more general branching structure, with less strict connection conditions than for a
tree
queue
tree stack
Type of Data Structures
• Homogenous: In this type of data structures, values of the same types of data are
stored.
• Array
• Non-Homogenous: In this type of data structures, data values of different types are
grouped and stored.
• Structures
• Classes
Abstract Data Type and
Data Structure
• Definition:-
• Abstract Data Types (ADTs) stores data and allow various operations on the data to access and change it.
• A mathematical model, together with various operations defined on the model
• An ADT is a collection of data and associated operations for manipulating that data
Abstract Data Type
• Encapsulation is binding the data, and the functions that use them
The Core Operations of ADT
• Every Collection ADT should provide a way to:
• add an item
• remove an item
• find, retrieve, or access an item
It is used for:
• web development (server-side),
• software development,
• mathematics,
• system scripting.
What can Python do?
• Python can be used on a server to create web
applications.
• Python can be used alongside software to create
workflows.
• Python can connect to database systems. It can also read
and modify files.
• Python can be used to handle big data and perform
complex mathematics.
• Python can be used for rapid prototyping, or for
production-ready software development.
Python Syntax compared to other
programming languages
• Python was designed for readability, and has some similarities to
the English language with influence from mathematics.
• Python uses new lines to complete a command, as opposed to other
programming languages which often use semicolons or parentheses.
• Python relies on indentation, using whitespace, to define scope;
such as the scope of loops, functions and classes. Other
programming languages often use curly-brackets for this purpose.
http://docs.python.org/
The Python tutorial is good!
Running
Python
Installing
or
Access Items
• List items are indexed and you can access them by
referring to the index number:
Recursion is defined as a process in which a function calls itself repeatedly. Recursion uses selection
structure. If the recursion step does not reduce the problem in a manner that converges on some
condition, called base condition, then an infinite recursion occurs. An infinite recursion can crash the
system. Recursion terminates when a base case is recognized.
Iteration is defined as the repetition of computational or mathematical procedure that continues until
the controlling condition becomes false. It uses repetition structure. If the loop condition test never
becomes false, then an infinite loop occurs with iteration
Recursions vs Iterations
When to avoid it?