bim213 – data structures and algorithms introduction 1

24
BIM213 – Data Structures and Algorithms Introduction 1

Upload: adrian-hodge

Post on 16-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BIM213 – Data Structures and Algorithms Introduction 1

BIM213 – Data Structures and Algorithms

Introduction

1

Page 2: BIM213 – Data Structures and Algorithms Introduction 1

Contents• Information about the course• Data Structures• Algorithms

2

Page 3: BIM213 – Data Structures and Algorithms Introduction 1

Course Information

3

Page 4: BIM213 – Data Structures and Algorithms Introduction 1

About the course

Lecturer: Cüneyt AKINLAR

Office Phone: 6553

E-mail Address: [email protected]

Web Page: http://ceng.anadolu.edu.tr/cakinlar

Teaching Assistant: Ahmet Murat TÜRK [email protected] ÖZCAN [email protected]

Course Web Page: http://ceng.anadolu.edu.tr/Ders.aspx?dersId=40

Class Hours and Location:

09:00-12:00, FRI on B7

Office Hours: 14:00-17:00, TUE

Prerequisites: - BIM101 – Computer Programming I- BIM102 – Computer Programming II

Textbooks: Data Structures & Problem Solving Using Java, Mark Allen Weiss, 4th Edition, Pearson, 2010.

4

Page 5: BIM213 – Data Structures and Algorithms Introduction 1

5

Course Outline• Iterative algorithms and their analysis

– Case Study: Iterative Sorting Algorithms

• Recursive algorithm design & analysis• Lists – ArrayList & LinkedList• Stacks, Queues• Trees• Search Trees

– Binary Search Trees– AVL Trees– Splay Trees

• Tries & Hash Tables

Page 6: BIM213 – Data Structures and Algorithms Introduction 1

Course Contents

Week 1 Introduction, Algorithm Analysis and Asymptotic (Big-O, Omega, Theta) Notations

Week 2 Iterative Sorting Algorithms: Bubble Sort, Selection Sort, Insertion Sort

Week 3 Introduction to Divide-and-Conquer (Recursive) Algorithms

Week 4 Lists and Array Implementation: ArrayList

Week 5 Religional Holliday

Week 6 First Midterm

Week 7 Linked Lists

6

Page 7: BIM213 – Data Structures and Algorithms Introduction 1

Course Contents (continued)

Week 8 Stacks and Queues

Week 9 Trees

Week 10 Binary Search Trees

Week 11 AVL Trees

Week 12 Second Midterm

Week 13 Splay Trees, Lower Bound on Comparison Based Search

Week 14 Hash Tables

Week 15 Review & Course Recap

Week 16 Final Exam

7

Page 8: BIM213 – Data Structures and Algorithms Introduction 1

Grading Plan• 1st MT: 20%, 2nd MT: 20%, Homework:

20%, Final: 40%.• Curve will be applied to the grades• If your grade is below 80%, you cannot

get the grade AA, but it is not certain that if you pass 80% then you get AA.

• If your grade is below 35%, you certainly fail, but this does not mean that you’ll get at least DD if you pass 35%.

8

Page 9: BIM213 – Data Structures and Algorithms Introduction 1

Sample Grading Plan

GradeLetter Grade

≥ 80 AA

≥ 75 AB

≥ 70 BA

≥ 65 BB

≥ 60 BC

GradeLetter Grade

≥ 55 CB

≥ 50 CC

≥ 45 CD

≥ 40 DC

≥ 35 DD

< 35 FF

9

Page 10: BIM213 – Data Structures and Algorithms Introduction 1

Attendances• You don’t have to attend the classes but

recent experiences show that the students who attend the classes are more successful

• All students are responsible for visiting the website of the course at least two times in each week

• Announcements, assignments, grades, and project subjects will be published on the website.

10

Page 11: BIM213 – Data Structures and Algorithms Introduction 1

Data Structures&

Algorithms

11

Page 12: BIM213 – Data Structures and Algorithms Introduction 1

12

What’s this course about?

• An algorithm (program) is a well-defined computational procedure that – takes some values (data) as “input” – produces some result as “output”

• Programs receive, manipulate, and output data– Need to organize data according to problem being

solved– Data structures are methods for organizing data

ALGORITHMInput (DATA) Output (Results)

Page 13: BIM213 – Data Structures and Algorithms Introduction 1

13

Data Structures (DS): What, How, and Why?

• Data structures are methods for organizing data

• Formal definition of DS: Abstract Data Type (ADT)– A “toolkit” of operations for manipulating data– E.g. A list with operations insert and delete– E.g. A stack with operations push and pop– E.g. A queue with operations enqueue and

dequeue

Page 14: BIM213 – Data Structures and Algorithms Introduction 1

14

Data Structures (DS): What, How, and Why?

• Program design depends crucially on data organization, i.e., how data is structured for use by the program– Implementation of some operations becomes

easier or harder– Speed of program may dramatically decrease or

increase– Memory used may increase or decrease

• We will see examples of these throughout the course

Page 15: BIM213 – Data Structures and Algorithms Introduction 1

15

Course Goals for Data Structures

• Study different implementation techniques for some fundamental ADTs

• Learn how to choose the “best” one

• Learn how to modify standard ADTs for specific problems, and create new ADTs

Page 16: BIM213 – Data Structures and Algorithms Introduction 1

16

Data Structures are used…• Everywhere

– Systems (Operating Systems, Computer Networks)

– Graphics– Databases– Theory– Artificial Intelligence– Information Retrieval– …

• Maybe the most important class in your curriculum – Guaranteed good and important stuff

Page 17: BIM213 – Data Structures and Algorithms Introduction 1

17

E.g. 1: Tree of Files and Folders

• Nodes: Files/folders• Edges: contains

/

docs Program Files

games

classes

BIM201 BIM213

PPTProject1

hw1.txt hw2.txt

main.cpp

project.sln

Page 18: BIM213 – Data Structures and Algorithms Introduction 1

18

E.g. 2: Queue of People

Front of the queue:Next person to be served

Rear of the queueNext person will join

the queuefrom the rear

Queue of people waiting to pay bills

Page 19: BIM213 – Data Structures and Algorithms Introduction 1

19

E.g. 3: Representing Expressions

• a = x*y + w-z; a

+

*

x y

-

w z

• Nodes: Symbols/Operators• Edges: Relationships

Page 20: BIM213 – Data Structures and Algorithms Introduction 1

20

E.g. 4: Balanced Search Trees

20

10

5 15

30

25 35

VeliID: 5GPA: 2.0

AliID: 10GPA: 3.0

CemID: 15GPA: 2.5

HasanID: 20GPA: 2.8

MehmetID: 25GPA: 3.4

TanerID: 30GPA: 3.2

AyseID: 35GPA: 2.9

Index

• Nodes: (Key/Value) pairs, Edges: Relationships

Page 21: BIM213 – Data Structures and Algorithms Introduction 1

21

E.g. 5: Transportation Networks

Eskisehir

Bozuyuk

Inegol

Sivrihisar

Bilecik

Sakarya

Polatli

Afyon

Kutahya

50

9080

40

30

70

90

60

50130

100

Bursa

60

• Nodes: Cities

• Edges: Roads

Page 22: BIM213 – Data Structures and Algorithms Introduction 1

22

Algorithms and their Analysis• What is an algorithm?

– A sequence of steps (a “program”) that accomplishes a task

– Independent of Programming Language

• Many different algorithms may correctly solve a given task– But choice of a particular algorithm may have

enormous impact on time and memory used– Time versus space tradeoffs are very common

Page 23: BIM213 – Data Structures and Algorithms Introduction 1

23

Types of Algorithms• Iterative Algorithms• Recursive (Divide & Conquer) Algorithms• Randomized Algorithms• Dynamic Programming• Greedy Algorithms• Approximation Algorithms• Genetic Algorithms

Page 24: BIM213 – Data Structures and Algorithms Introduction 1

24

Course Goals for Algorithms• Understand the mathematical

fundamentals needed to analyze algorithms

• Learn how to compare the efficiency of different algorithms in terms of running time and memory usage

• Study a number of standard algorithms for data manipulation and learn to use them for solving new problems