Coursenotes CS3114: Data Structures and Algorithms Clifford A. Shaffer Yang Cao Department of Computer Science Virginia Tech Copyright © 2008-2011.

Slides:



Advertisements
Similar presentations
Analysis of Computer Algorithms
Advertisements

PROGRAMMING LANGUAGE (JAVA) UNIT 42 BY ROBERT BUTTERFIELD TELEPHONE Data Structures and Algorithms.
Data Structures.
COEN 352 Data structures and Algorithms R. Dssouli.
Computer science is a field of study that deals with solving a variety of problems by using computers. To solve a given problem by using computers, you.
What is an Algorithm? (And how do we analyze one?)
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
Ch1: File Systems and Databases Hachim Haddouti
Abstract Data Types (ADT)
1 8/28/06CS150 Introduction to Computer Science 1 Professor: Chadd Williams
1 CS150 Introduction to Computer Science 1 Professor: Chadd Williams
CS2336: Computer Science II
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Introduction - The Need for Data Structures Data structures organize data –This gives more efficient programs. More powerful computers encourage more complex.
1 A Introduction to Data Structures and Algorithm Analysis Data Structures Asst. Professor Kiran Soni.
Analysis of Algorithms Spring 2015CS202 - Fundamentals of Computer Science II1.
Data Structures Lecture-1:Introduction
Data Access Patterns. Motivation Most software systems require persistent data (i.e. data that persists between program executions). In general, distributing.
Problem Solving and Programming Design –Requires intense concentration –When is the best time to fix bugs? Testing –Requires a lot of skill, practice –How.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
Lecture No.01 Data Structures Dr. Sohail Aslam
Fundamentals of Algorithms MCS - 2 Lecture # 1
Dr. Engr. Sami ur Rahman Assistant Professor Department of Computer Science University of Malakand Data Structure: Introduction.
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.
Querying Large Databases Rukmini Kaushik. Purpose Research for efficient algorithms and software architectures of query engines.
Prepared By Ms.R.K.Dharme Head Computer Department.
Scheduling Managing large-scale projects involves scheduling activities –It is human nature to work better toward intermediate milestones. The same concepts.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
1 CSC 222: Computer Programming II Spring 2004 See online syllabus at: Course goals:
1 CS 350 Data Structures Chaminade University of Honolulu.
Course notes CS2606: Data Structures and Object-Oriented Development Ryan Richardson John Paul Vergara Department of Computer Science Virginia Tech Spring.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Chapter 1 Data Structures and Algorithms. Primary Goals Present commonly used data structures Present commonly used data structures Introduce the idea.
Component 4: Introduction to Information and Computer Science Unit 6a Databases and SQL.
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
Coursenotes CS3114: Data Structures and Algorithms Clifford A. Shaffer Department of Computer Science Virginia Tech Copyright ©
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Algorithms and data structures: basic definitions An algorithm is a precise set of instructions for solving a particular task. A data structure is any.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
1 CS 311 Data Structures. 2 Instructor Name : Vana Doufexi Office : 2-229, Ford Building Office hours: By appointment.
Chapter 8 Physical Database Design. Outline Overview of Physical Database Design Inputs of Physical Database Design File Structures Query Optimization.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
1 A Practical Introduction to Data Structures and Algorithm Analysis Chaminade University of Honolulu Department of Computer Science Text by Clifford Shaffer.
Data Structure and Algorithms
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Analysis of Algorithms Spring 2016CS202 - Fundamentals of Computer Science II1.
An Introduction to Programming with C++1 Beginning the Problem- Solving Process Tutorial 2.
南昌大学自动化系胡凌燕 1 Charpter 1 The data structures and algorithms (p3) There are often many approaches to solving a problem. How do we choose between them? 
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.
Introduction To Algorithm and Data Structures Course Teacher: Moona Kanwal -Algorithm Design -Algorithm Analysis -Data structures -Abstract Data Type.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Advanced Data Structures Lecture 1
Introduction toData structures and Algorithms
Course Developer/Writer: A. J. Ikuomola
Intro Data Structure.
Record Storage, File Organization, and Indexes
Introduction to Computer Programming
Objective of This Course
What is CS 253 about? Contrary to the wide spread belief that the #1 job of computers is to perform calculations (which is why the are called “computers”),
Scheduling and Student Performance
Data Structures: Introductory lecture
Algorithm Efficiency and Sorting
Problem Solving and Programming
Algorithms and data structures: basic definitions
Database management systems
Presentation transcript:

Coursenotes CS3114: Data Structures and Algorithms Clifford A. Shaffer Yang Cao Department of Computer Science Virginia Tech Copyright ©

Goals of this Course 1.Reinforce the concept that costs and benefits exist for every data structure. 2.Learn the commonly used data structures. –These form a programmer's basic data structure ``toolkit.'‘ 3.Understand how to measure the cost of a data structure or program. –These techniques also allow you to judge the merits of new data structures that you or others might invent.

The Need for Data Structures Data structures organize data  more efficient programs. More powerful computers  more complex applications. More complex applications demand more calculations. Complex computing tasks are unlike our everyday experience.

Organizing Data Any organization for a collection of records can be searched, processed in any order, or modified. The choice of data structure and algorithm can make the difference between a program running in a few seconds or many days.

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.

Selecting a Data Structure Select a data structure as follows: 1.Analyze the problem to determine the basic operations that must be supported. 2.Quantify the resource constraints for each operation. 3.Select the data structure that best meets these requirements.

Some Questions to Ask Are all data inserted into the data structure at the beginning, or are insertions interspersed with other operations? Can data be deleted? Are all data processed in some well- defined order, or is random access allowed?

Costs and Benefits Each data structure has costs and benefits. Rarely is one data structure better than another in all situations. Any data structure requires: –space for each data item it stores, –time to perform each basic operation, –programming effort.

Costs and Benefits (cont) Each problem has constraints on available space and time. Only after a careful analysis of problem characteristics can we know the best data structure for the task. Bank example: –Start account: a few minutes –Transactions: a few seconds –Close account: overnight

Example 1.2 Problem: Create a database containing information about cities and towns. Tasks: Find by name or attribute or location Exact match, range query, spatial query Resource requirements: Times can be from a few seconds for simple queries to a minute or two for complex queries

Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely in terms of a set of values and a set of operations on that data type. Each ADT operation is defined by its inputs and outputs. Encapsulation: Hide implementation details.

Data Structure A data structure is the physical implementation of an ADT. –Each operation associated with the ADT is implemented by one or more subroutines in the implementation. Data structure usually refers to an organization for data in main memory. File structure: an organization for data on peripheral storage, such as a disk drive.

Metaphors An ADT manages complexity through abstraction: metaphor. –Hierarchies of labels Ex: transistors  gates  CPU. In a program, implement an ADT, then think only about the ADT, not its implementation.

Logical vs. Physical Form Data items have both a logical and a physical form. Logical form: definition of the data item within an ADT. –Ex: Integers in mathematical sense: +, - Physical form: implementation of the data item within a data structure. –Ex: 16/32 bit integers, overflow.

Data Type ADT: Type Operations Data Items: Logical Form Data Items: Physical Form Data Structure: Storage Space Subroutines

Example 1.8 A typical database-style project will have many interacting parts.

Scheduling Managing large-scale projects involves scheduling activities –It is human nature to work better toward intermediate milestones. The same concepts can/should be applied to mid-sized projects encountered in class. –For any project that needs more than a week of active work to complete, break into parts and design a schedule with milestones and deliverables.

Real Results #1 CS2606, Fall week projects Kept schedule information: –Estimated time required –Milestones, estimated times for each –Weekly estimates of time spent.

Real Results #2 Amount Done 1 Week Prior to Due Date

Real Results #3 Results were significant: –90% of scores below median were students who did less than 50% of the project prior to the last week. –Few did poorly who put in > 50% time early –Some did well who didn’t put in >50% time early, but most who did well put in the early time

Real Results #4 Correlations: –Strong correlation between early time and high score –No correlation between time spent and score –No correlation between % early time and total time 21

What is the Mechanism? Correlations are not causal –Do they behave that way because they are good, or does behaving that way make them good? Spreading projects over time allows the “sleep on it” heuristic to operate Avoiding the “zombie” effect makes people more productive (and cuts time requirements)

23 Mathematical Background Set concepts and notation Logarithms Recursion Induction Proofs Summations Recurrence Relations

Set

Relations A relation R over a set S is a set of ordered pairs from S. Example: = Common Properties: Partial and total order relations

Logarithm Definition:

Summation

Recurrence Relations An algorithm is recursive if it calls itself to do part of its work. Example: 1. Compute n! 2. Hanoi puzzle

Mathematical Proof Three ways of mathematical proof 1.Direct Proof 2.Proof by Contradiction 3.Proof by mathematical induction Example Proof: The number of steps for the Hanoi puzzle is 2 n -1, where n is the number of disks.