data structures lecture 1: introduction azhar maqsood nust institute of information technology...

20
Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Upload: kevin-patterson

Post on 28-Dec-2015

222 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Data Structures

Lecture 1: Introduction

Azhar MaqsoodNUST Institute of Information Technology (NIIT)

Page 2: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Administrative Instructor: Azhar Maqsood

[email protected] Extension: 136 Academic Block 2, Faculty Office Web Address : http://www.niit.edu.pk/~azhar

Consulting hours: Tuesdays and Thursdays Depends on your schedule

Email me and get in touch if in need Regularly check course folder in FileSvr and My

website

Page 3: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Course Contents

Data Types Overview, Introductory concepts Data Types, meaning and implementation Abstract data types (ADT) Arrays (revisited) Structures

Linked Lists Stacks (recursion) Queues Trees (traversals, implementation)

Page 4: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Course Contents

Binary Trees Indexing Methods

Hashing

Binary Search Trees Balanced Search Trees

(AVL Tree) Adelson-Velskii-LandisAdelson-Velskii-Landis

Heaps Splay Trees Graphs, adjacency matrices and lists

Page 5: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Text book

““Data structures using C and C++”, Yedidyah Data structures using C and C++”, Yedidyah Langsam, Moshe J Augenstein and Aaron M. Langsam, Moshe J Augenstein and Aaron M. Tenenbaum, 2 ed, 2002Tenenbaum, 2 ed, 2002

Reference Books:• D. Wood: “Data structures, algorithms and performance”,

Addison-Wesley, 1993

• C++ Data Structures by Nell Dale and David Teague

• http://www.brpreiss.com/books/opus4/html/book.html

• Any other book on Data Structures

Page 6: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Assignment Policy

DO NOT copy assignments Both of the copy cases will be graded zero

Submission time will be 1500 hrs on the due date NO credit on LATE submission of any

deliverable.

No excuse of USB/Floppy/email servers not working

Sorry! No Exceptions

Page 7: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Weightage

OHT’s 30% (15 +15) Quizzes 10% Assignments 10% Project 5% Final Test 45%

Minimum Quizzes : 5-6 (Unannounced) Assignments : 1 Every 3 weeks

Page 8: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Honor Code

Dishonesty will NOT be tolerated. Will result in zero marks in the corresponding

work

Page 9: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Lets start the course!

Page 10: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Why Study?

Designed to develop students understanding the impact of structuring data to achieve efficiency of a solution to a problem

After completion you will be familiar with important and most often used data structuring techniques.

It will enable you to understand the manner in which data is organized and presented later.

Page 11: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Objectives of the course

Present in a systematic fashion the most commonly used data structures, emphasizing their abstract properties.

Discuss typical algorithms that operate each kind of data structure, and analyze their performance.

Compare different Data Structures for solving the same problem, and choose the best

Page 12: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Abstract Data Type ADT

A data type whose properties (domain and operations) are specified independently of any particular implementation

ADT is a mathematical model which gives the a set of utilities available to the user but never states the details of its implementation.

In OO-Programming a Class is an ADT

Page 13: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Data Structures: Definition

A collection of data elements whose organization is characterized by accessing operations that are used to store and retrieve the individual data elements;

The logical arrangement of data as used by a system for data management; a representation of a data model in computer form

Page 14: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Data Structures: More specifically

A data structure is a way of grouping fundamental types (like integers, floating point numbers, and arrays) into a bundle that represents some identifiable thing. For example, a matrix may be thought of as the bundle of

the number of rows and columns, and the array of values of the elements of the matrix. This information must be known in order to manipulate the matrix.

C introduced the struct for declaring and manipulating data structures. C++ extended the struct to a class

Page 15: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Goals of Data structures

Identify and develop useful mathematical entities and operations and to determine what classes of problems can be solved by using these entities and operations.

Determine representation of those abstract entities and to implement the abstract operation on these concrete representations.

Page 16: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

A Real Life Example Lisa Michele John 110 622-9823 112-4433 75 Bronson Paola

Electronic Phone BookContains different DATA:

- names- phone number- addresses

Need to perform certain OPERATIONS:- add- delete- look for a phone number- look for an address

How to organize the data so to optimize the efficiency of the operations

Page 17: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

The first Data Structure

An Array!

Page 18: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Word about Arrays!

Lets Get Started:

Arrays are data structures Finite Contiguous Fast Direct Access All elements of same data type

(Can be based upon primitive or ADT) Insertion / Deletion ??? HOW??

Page 19: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Arrays

How to Input arrays How to process arrays How to insert an item in an array How to delete an item from an array How to pass an array

Page 20: Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)

Array

22 33 77 88

How to add 4

22 33 44 77 88

How to add 1 in the array?Not possible