You are on page 1of 10

Data Structures and

Algorithms

Lecture 1
Introduction

•Object Oriented Design


•Java Classes and instances concepts
•Why Data Structures is important
As computer scientist, our job is to perform operations on
data and perform the following three steps :-

1)Takesome input 
2) Process it 
3) Give back the output.

2nd step of processing


What are data structures?

•Data structure is a particular


way of storing and  organizing
information in a computer so that
it can be retrieved and used most
productively.

•Different kinds of data structures


are meant  for different kinds
of applications, and some are
highly specialized to specific
tasks.
Importance of Data Structures

•Data structures are important for the


following reasons:
1. Data structures are used in almost
every program or software system.
2. Specific data structures are
essential ingredients of many efficient
algorithms, and make possible the
management of huge amounts of
data, such as large integrated
collection 
of databases.
What do you do to peel
a banana? As a human?

Just grab it and peel it right?


Now here are the instructions for a
computer [Algorithm](with an arm that • Initialize power to arm
can peel of course): • Extend arm to
banana.length(x)
• Rotate hand 90 degrees
• Open Hand
• Move hand to Pitch Yaw
Roll of  "bananaTop"
• Close hand on variable
"stem"
• Move arm down to
"bananaBottom"
• Iterate through steps 4 -
7 until variable
bananaPeelsides === 0
• Break
Algorithms

• Algorithms are methods to implement certain


task.
• Algorithm is general word which suggest a
process to perform task in sequential manner.
• Algorithms are developed to perform task
more efficiently.
• If you write code as per your perception and
judgement without applying any predefined
algorithm, your code will be botched up after
certain time. It is because you haven’t applied
any predefined approach or methodology.
Data structures and
algorithms
• Using combination of data structure and
algorithms, we can improve performance of
program drastically.
• For example, you are using any searching
algorithm like binary search, then set data
structure would be perfect rather than array.
• The reason is, set is much better for checking
whether element is present in specified place
or not.
• This is actually not a quite good example but
it can tell you the actual need of data
structure in algorithms.
Real Examples
1.Store social network “feeds”. You do not know the size, and things may need to be
dynamically added.
2. Store undo/redo operations in a word processor.
3. Store an image (1000 by 1000 pixels) as a bitmap.
4. To implement printer spooler so that jobs can be printed in the order of their arrival.
5. To implement back functionality in the internet browser.
6. To store the possible moves in a chess game.
7. To store a set of fixed key words which are referenced very frequently.
8. To store the customer order information in a drive-in burger place. (Customers keep
on coming and they have to get their correct food at the payment/food collection
window.)

You might also like