DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room:2.501.29 

Slides:



Advertisements
Similar presentations
MATH 224 – Discrete Mathematics
Advertisements

Lecture3: Algorithm Analysis Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
CSC401 – Analysis of Algorithms Lecture Notes 1 Introduction
© 2004 Goodrich, Tamassia 1 Lecture 01 Algorithm Analysis Topics Basic concepts Theoretical Analysis Concept of big-oh Choose lower order algorithms Relatives.
Analysis of Algorithms Algorithm Input Output. Analysis of Algorithms2 Outline and Reading Running time (§1.1) Pseudo-code (§1.1) Counting primitive operations.
Complexity Analysis (Part I)
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Analysis of Algorithms1 CS5302 Data Structures and Algorithms Lecturer: Lusheng Wang Office: Y6416 Phone:
Analysis of Algorithms (Chapter 4)
CSE 830: Design and Theory of Algorithms
Analysis of Algorithms1 Estimate the running time Estimate the memory space required. Time and space depend on the input size.
Introduction to Analysis of Algorithms Prof. Thomas Costello (reorganized by Prof. Karen Daniels)
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Analysis of Algorithms1 CS5302 Data Structures and Algorithms Lecturer: Lusheng Wang Office: Y6416 Phone:
The Design and Analysis of Algorithms
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
DATA STRUCTURE Subject Code -14B11CI211.
Analysis of Performance
Analysis of Algorithms Algorithm Input Output © 2014 Goodrich, Tamassia, Goldwasser1Analysis of Algorithms Presentation for use with the textbook Data.
Analysis of Algorithm Lecture 1
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
Data Structures Lecture 1: Introduction Azhar Maqsood NUST Institute of Information Technology (NIIT)
C. – C. Yao Data Structure. C. – C. Yao Chap 1 Basic Concepts.
CSCE 3110 Data Structures & Algorithm Analysis Algorithm Analysis I Reading: Weiss, chap.2.
Data Structures & AlgorithmsIT 0501 Algorithm Analysis I.
Analysis Tools Jyh-Shing Roger Jang ( 張智星 ) CSIE Dept, National Taiwan University.
Algorithm Input Output An algorithm is a step-by-step procedure for solving a problem in a finite amount of time. Chapter 4. Algorithm Analysis (complexity)
Analysis of Algorithms1 Running Time Pseudo-Code Analysis of Algorithms Asymptotic Notation Asymptotic Analysis Mathematical facts.
Computer Science Department Data Structures and Algorithms Lecture 1.
Instructor Information: Dr. Radwa El Shawi Room: Week # 1: Overview & Review.
GC 211:Data Structures Week#1: Overview & Review
DATA STRUCTURES (CS212D) Week # 1: Overview & Review.
CS212: DATA STRUCTURES Lecture 1: Introduction. What is this course is about ?  Data structures : conceptual and concrete ways to organize data for efficient.
1 Introduction to Data Structures. 2 Course Name : Data Structure (CSI 221) Course Teacher : Md. Zakir Hossain Lecturer, Dept. of Computer Science Stamford.
 DATA STRUCTURE DATA STRUCTURE  DATA STRUCTURE OPERATIONS DATA STRUCTURE OPERATIONS  BIG-O NOTATION BIG-O NOTATION  TYPES OF DATA STRUCTURE TYPES.
1 Analysis of Algorithms CS 105 Introduction to Data Structures and Algorithms.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Data Structure Introduction.
Data Structures Lecture 1: Introduction. Course Contents Data Types   Overview, Introductory concepts   Data Types, meaning and implementation  
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Elementary Data Organization. Outline  Data, Entity and Information  Primitive data types  Non primitive data Types  Data structure  Definition 
Data Structures & Algorithms CHAPTER 1 Introduction Ms. Manal Al-Asmari.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Data Structure and Algorithms
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Announcement We will have a 10 minutes Quiz on Feb. 4 at the end of the lecture. The quiz is about Big O notation. The weight of this quiz is 3% (please.
Data Structures I (CPCS-204)
GC 211:Data Structures Week 2: Algorithm Analysis Tools Slides are borrowed from Mr. Mohammad Alqahtani.
1 COMP9024: Data Structures and Algorithms Week Two: Analysis of Algorithms Hui Wu Session 2, 2014
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
Lecture 1 Data Structures Aamir Zia. Introduction Course outline Rules and regulations Course contents Good Programming Practices Data Types and Data.
Data Structures I (CPCS-204) Week # 2: Algorithm Analysis tools Dr. Omar Batarfi Dr. Yahya Dahab Dr. Imtiaz Khan.
Advanced Data Structures Lecture 1
Introduction toData structures and Algorithms
GC 211:Data Structures Week 2: Algorithm Analysis Tools
GC 211:Data Structures Algorithm Analysis Tools
GC211Data Structure Lecture2 Sara Alhajjam.
Data Structures (CS212D) Overview & Review.
Objective of This Course
GC 211:Data Structures Algorithm Analysis Tools
Introduction CSE 373 Data Structures.
Some slides are borrowed from Mr. Mohammad Alqahtani
Week # 1: Overview & Review
GC 211:Data Structures Algorithm Analysis Tools
Data Structures (CS212D) Overview & Review.
Introduction to Data Structures
Administrivia- Introduction
Revision of C++.
Analysis of Algorithms
Presentation transcript:

DATA STRUCTURES (CS212D) Overview & Review

Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 

Course objectives  Be familiar with problem solving.  Be familiar with basic techniques of algorithm analysis.  Be familiar with the concept of recursion.  Master the implementation of linked data structures such as linked lists, stacks, and queues.

Course objectives Cont.  Be familiar with advanced data structures such as balanced search trees, graphs and hash tables.  Master analyzing problems and writing program solutions to problems using the above techniques  Be able to select appropriate data structures and algorithms for given problems

Course Outline  Introduction to data structures  Arrays  Recursion  Linked Lists  Stacks and queues  Trees  Graphs  Hash tables

Course Material  Textbook: Data Structures & Algorithms in JAVA (6 th Edition), by M. Goodrich, R. Tamassia and M. Goldwasser, John Wiley & Sons, inc.,  Lecture hand-outs  Lab notes and exercises

Grading/Evaluation Course Assessment ToolsPercent Mid term 115% Mid term 215% Lab assignments, quizzes and participation 10% Final lab20% Final40%

What is data?  Data  A collection of facts from which conclusion may be drawn  e.g. Data: Temperature 35°C; Conclusion: It is hot.  Types of data  Textual: For example, your name (Nourah)  Numeric: For example, your ID (090254)  Audio: For example, your voice  Video: For example, your voice and picture  (...)

What is data structure?  A particular way of storing and organizing data in a computer so that it can be used efficiently and effectively.  Data structure is the logical or mathematical model of a particular organization of data.  A group of data elements grouped together under one name.  For example, an array of integers

There are many, but we named a few. We’ll learn these data structures in details through this term! Array Linked List Tree Queue Stack Types of data structures

The Need for Data Structures  Goal: to organize data  Criteria: to facilitate efficient  storage of data  retrieval of data  manipulation of data  Design Issue:  select and design appropriate data types (This is the main motivation to learn and understand data structures)

Data Structure Operations  Traversing  Accessing each data element exactly once so that certain items in the data may be processed  Searching  Finding the location of the data element (key) in the structure  Insertion  Adding a new data element to the structure

Data Structure Operations (cont.)  Deletion  Removing a data element from the structure  Sorting  Arrange the data elements in a logical order (ascending/descending)  Merging  Combining data elements from two or more data structures into one

What is algorithm?  A finite set of instructions which accomplish a particular task  A method or process to solve a problem  Transforms input of a problem to output  Algorithm = Input + Process + Output  Algorithm development is an art – it needs practice, practice and only practice!

What is a good algorithm?  It must be correct  It must be finite (in terms of time and size)  It must terminate  It must be unambiguous  Which step is next?  It must be space and time efficient  A program is an instance of an algorithm, written in some specific programming language

A simple algorithm  Problem: Find maximum of a, b, c  Algorithm  Input = a, b, c  Output = max  Process o Let max = a o If b > max then max = b o If c > max then max = c o Display max  Order is very important!!!

Algorithm development: Basics  Clearly identify:  what output is required?  what is the input?  What steps are required to transform input into output o The most crucial bit o Needs problem solving skills o A problem can be solved in many different ways o Which solution, amongst the different possible solutions is optimal?

Algorithm Design: Practice  Example 1: Determining even/odd number  A number divisible by 2 is considered an even number, while a number which is not divisible by 2 is considered an odd number. Write pseudo-code to display first N odd/even numbers.  Example 2: Computing Weekly Wages  Gross pay depends on the pay rate and the number of hours worked per week. However, if you work more than 40 hours, you get paid time-and-a-half for all hours worked over 40. Write the pseudo-code to compute gross pay given pay rate and hours worked

Even/ Odd Numbers  Input range  for num←0; num<=range; num←num+1 do  if num % 2 = 0 then  print num is even  else  print num is odd  endif  endfor

Computing weekly wages Input hours_worked, pay_rate if hours_worked <= 40 then gross_pay ← pay_rate x hours_worked else basic_pay ← pay_rate x 40 over_time ← hours_worked – 40 over_time_pay ← 1.5 x pay_rate x over_time gross_pay ← basic_pay + over_time_pay endfor print gross_pay

What is algorithm analysis?  A methodology to predict the resources that the algorithm requires  Computer memory  Computational time  We’ll focus on computational time  It does not mean memory is not important  Generally, there is a trade-off between the two factors o Space-time trade-off is a common term

How to analyse algorithms?  Experimental Approach  Implement algorithms as programs and run them on computers  Not a good approach, though! o Results only for a limited set of test inputs o Difficult comparisons due to the experiment environments (need the same computers, same operating systems, etc.) o Full implementation and execution of an algorithm  We need an approach which allows us to avoid experimental study

How to analyse algorithms?  Theoretical Approach  General methodology for analysing the running time o Considers all possible inputs o Evaluates algorithms in a way that is independent from the hardware and software environments o Analyses an algorithm without implementing it  Count only primitive operations used in an algorithm  Associate each algorithm with a function f(n) that characterises the running time of the algorithm as a function of the input size n o A good approximation of the total number of primitive operations

Primitive Operations  Basic computations performed by an algorithm  Each operation corresponding to a low-level instruction with a constant execution time  Largely independent from the programming language  Examples  Evaluating an expression ( x + y )  Assigning a value to a variable ( x ←5 )  Comparing two numbers ( x < y )  Indexing into an array ( A[i] )  Calling a method ( mycalculator.sum() )  Returning from a method ( return result )

Counting Primitive Operations  Total number of primitive operations executed  is the running time of an algorithms  is a function of the input size  Example  Algorithm ArrayMax(A, n) # operations  currentMax ←A[0] 2: (1 +1)  for i←1;i<n; i←i+1 do 3n-1: (1 + n+2(n- 1))  if A[i]>currentMax then 2(n − 1)  currentMax ←A[i] 2(n − 1)  endif  endfor  return currentMax 1  Total: 7n − 2

Algorithm efficiency: growth rate  An algorithm’s time requirements can be expressed as a function of (problem) input size  Problem size depends on the particular problem:  For a search problem, the problem size is the number of elements in the search space  For a sorting problem, the problem size is the number of elements in the given list  How quickly the time of an algorithm grows as a function of problem size -- this is often called an algorithm’s growth rate

Algorithm growth rate Which algorithm is the most efficient? [The one with the growth rate Log N.]

Homework 1.Write an algorithm to find the largest of a set of numbers. You do not know the number of numbers. 2.Write an algorithm that finds the average of (n) numbers. For example numbers are [4,5,14,20,3,6]s