[go: up one dir, main page]

0% found this document useful (0 votes)
56 views14 pages

Chapter 01 - Introduction To DSA

Data structures are ways of organizing and storing data in a computer so it can be used efficiently. Common data structures include files, lists, arrays, records, trees and tables. Algorithms are sets of steps to solve a problem and must be unambiguous and have a clear stopping point. Data structures and algorithms are closely related, as algorithms often operate on data collections and the choice of data structure impacts the efficiency of algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views14 pages

Chapter 01 - Introduction To DSA

Data structures are ways of organizing and storing data in a computer so it can be used efficiently. Common data structures include files, lists, arrays, records, trees and tables. Algorithms are sets of steps to solve a problem and must be unambiguous and have a clear stopping point. Data structures and algorithms are closely related, as algorithms often operate on data collections and the choice of data structure impacts the efficiency of algorithms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Introduction to Data Structures

& Algorithms
Lecture 01
Objective
• What is data structure?
• Basic types of data structure
• What is algorithm?
• Data structures and Algorithms
What is data structure (DS)?
• It’s a way of storing data in a computer so it can be
used efficiently.
• A way of organizing data considers not only the
items stored, but also their relationship to each
other.
Why data structure (DS)?
• Knowledge about relationship between data items allows
designing of efficient algorithms for manipulation of items.
• Careful chosen DS will allow more efficient algorithms
• Choice of DS often begins with the choice of an abstract
data structure.
• Well designed DS allows variety of critical operations to be
performed on using a little resources (execution time,
memory spaces, etc)
• Different DS(s) suited for different applications, some are
highly specialized e.g., B-trees is god for databases, hash
tables is good for compiler to lookup identifiers.
Why DS is important in Computer Science
• DS is used in most programs
• DS provides a means to manage huge amounts of
data efficiently
– databases, internet indexing services, etc
• Efficient DS(s) are the key to designing efficient
algorithms.
• Some formal design methods and programming
languages emphasize DS(s) rather than algorithms
– key organizing factor of software design
• Algorithms + Data Structures = Programs
Basic Types of DS(s)
• Files
• Lists
• Arrays
• Records
• Trees
• Tables
What is an algorithm?
• Formula or set of steps for solving a particular
problem.
• To be an algorithm, a set of rules must be
unambiguous and have a clear stopping point.
• Algorithms can be expressed in any language, from
natural languages to programming languages
– We use algorithms every day. E.g., a recipe for baking a cake
is an algorithm
– Most programs consist of algorithms
– Inventing elegant algorithms – should be simple and fewest
steps possible – is challenges in programming
Algorithm example
Properties of an algorithm
1. Input – an algorithm accepts zero or more inputs
2. Output – it produces at least one output
3. Finiteness – it terminates after a finite steps
4. Definiteness – each step in algorithm is un ambiguous.
Means can be interpreted in one way only and can be
performed without any confusion
5. Effectiveness – it consists basic, realizable instructions.
Means Instructions can be performed using given
input in a finite amount of resources (time, space)
6. Generality – it must work for a general set of inputs
How to represent algorithms?
• Use natural languages
– Too verbose
– Too “context-sensitive” – relies on experience of reader
• Use formal programming languages
– Too low level
– Requires us to deal with complicated syntax of programming language
• Use Pseudo-code (alias programming language)
– natural language constructs modeled to look like statements available in
many programming languages
• Use Flowchart (diagram)
– A flowchart can represent algorithms or process, showing steps as boxes of
various kinds, order by connecting arrows.
– Flowchart is used in analyzing, designing, documenting or managing a
process or program in various fields
Algorithm representation examples
• Problem: find the greatest of three numbers
Algorithm representation examples
Flowchart
Data Structures and Algorithms
• Most algorithms operate on data collections, so
define
• Collection Abstract Data Type (ADT)
– Methods
• Constructor/Destructor
• Add/Delete
• Find
• Sort
• …
Summaries
• What is data structure?
• Basic types of data structure
• What is algorithm?
• Data structures and Algorithms

You might also like