0% found this document useful (0 votes)
125 views15 pages

Data Structures: Lecture No. 1

The document provides an introduction to the topic of data structures. It outlines the course objectives, contents, and topics that will be covered such as arrays, lists, stacks, queues, trees, hashing, and graphs. It also defines what a data structure is, different types, and how they are helpful for efficiently solving problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views15 pages

Data Structures: Lecture No. 1

The document provides an introduction to the topic of data structures. It outlines the course objectives, contents, and topics that will be covered such as arrays, lists, stacks, queues, trees, hashing, and graphs. It also defines what a data structure is, different types, and how they are helpful for efficiently solving problems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Data Structures

Introduction
Asim Rehan

Lecture No. 1
About you?
• You are here because?

– There is no other option 


– What if you had an option?

• This is the core course not without any good


reason!
General Overview
Introduction to
Computer Science

What is Hardware, Software, Programming, Operating System etc

Computer
Programming

How to write software with the help of procedural and object oriented
programming?

Data Structures

How to efficiently utilize resources with the help of different data structures?

Algorithm Analysis

How to efficiently solve complex problems?


Course objectives
• In simple words, you will learn how to write
efficent programs.

• At a personal level, I would be more than happy


if I can make you think and teach you to be
honest.
Course Contents
• Introduction
• Simple Data Types and Abstract Data
Types
• Arrays
• Searching techniques FIRST SESSION
• Sorting techniques
• Lists
• Stack
• Queues

• Trees SECOND SESSION


• Hashing

• Graphs
• Heaps FINAL SESSION
What is a data structure?
• The primary purpose of most computer
programs is not only to perform calculations,
but also to store and retrieve information-as
fast as possible.

• More typically, a data structure provides a way


of organization for a collection of data items

6
Types of Data Structures
• Linear DS
• In linear DS the values are arranged in a
sequence. Like arrays, Linked list, stack,
queues.

• Non-Linear DS
• Opposite to linear DS. The values are not
arranged in a sequence. Like Trees, Graphs,
and tables
Operations on Data Structures
• Data is useless if it cannot be processed, we must
identify which operations are needed to process the
data for solving given problem.

– Insertion: Adding new data item in DS.


– Deletion: Deleting a data item from DS.
– Searching: Finding specific data item in the list.
– Traversing: Access each record exactly once called traversing or
visiting.
– Sorting: Arranging the data items in the DS.
– Merging: Combining multiple groups into a single group.
Types of Algorithms:
• An algorithm is a well-defined and effective
sequence of computation steps that takes some
value, or set of values, as input and produces
some value, or set of values, as output.

• Linear Algorithms
– Linear algorithms does something, once to every
object in the collection of objects. Looking up words
in dictionary, adding all numbers in an array.
• Divide and Conquer
– divide the problems in to pieces and work on the
pieces.
• Greedy Algorithms
– try to solve problems by selecting the best piece
first and then the smaller one latter. First biggest
value in the array then smaller.
• Iterative Algorithms
– in order to obtain correct result we start with a
value and repeatedly change in the direction of
solution, like factorial till zero.
Where Data Structure is Helpful?
• The choice of efficient data structure makes
the difference between a program running in a
few seconds or many days
What is Data Structure Efficiency?
• A solution is said to be efficient if it solves the
problem within its resource constraints.
– Space
– Time

• The cost of a solution is the amount of


resources that the solution consumes.
Costs and Benefits
• Each data structure has costs and benefits.

• It is very difficult to find a data structure that


is better than others in all situations.

• A data structure requires:


– space for each data item it stores,
– time to perform each basic operation,
– programming effort.
Books
• Data Structures Using C and C++ (By Y. Langsam, M. J.
Augenstein, A. M. Tenenbaum)

• Data Structures and Algorithms (By A. V. Aho, J. E.


Hopcroft, J. D. Ullman)

• Schaum's Outline Series, Theory and problems of Data


Structures (By Seymour Lipschutz)

• Data Structures Using C++ (By D.S. Malik)

Some topics will be covered from other books. Material will


be provided for these topics.
• Greater Number from an array. Max function to
display and find.

• Display only even values.

You might also like