Data Structure. Lecture#2: Data Structures and Algorithms. U Kang Seoul National University. U Kang (2016) 1

Similar documents
Purpose of Data Structures

Chapter 6 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS

What is an algorithm?

Data Structures and Algorithms. Chapter 1

What is an algorithm?

CS133 C Programming. Instructor: Jialiang Lu Office: Information Center 703

Introduction to Computers & Programming

เพ มภาพตามเน อหาของแต ละบท. MS-Access. by Asst. Prof. Wassanaa Naiyapo adapted into English by Dr. Prakarn Unachak IT AND MODERN LIFE

DATA STRUCTURES USING C

Tutorial notes on. Object relational structural patterns

CS2102, B11 Exam 1. Name:

CMPT 354: Database System I. Lecture 2. Relational Model

Data Abstraction. Hwansoo Han

Software and Programming 1

Spring 2013 CS 122C & CS 222 Midterm Exam (and Comprehensive Exam, Part I) (Max. Points: 100)

Data Structures and Algorithms

CSI33 Data Structures

Arrays: Higher Dimensional Arrays. CS0007: Introduction to Computer Programming

Database Management Systems MIT Introduction By S. Sabraz Nawaz

What is a Database? CMPSCI 105: Lecture #15 Introduction to Databases. Spreadsheets vs. Databases. One Skill You Will Develop

MIT Database Management Systems Lesson 01: Introduction

Programmazione. Prof. Marco Bertini

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

3D Graphics Programming Mira Costa High School - Class Syllabus,

Database Applications (15-415)

Data Structure Lecture#15: Non-Binary Trees 2 (Chapter 6) U Kang Seoul National University

REVIEW AND OUTLOOKS OF THE MEANS FOR VISUALIZATION OF SYNTAX SEMANTICS AND SOURCE CODE. PROCEDURAL AND OBJECT ORIENTED PARADIGM DIFFERENCES

Data Structures and Algorithms in Java. Second Year Software Engineering

Introduction to Object-Oriented Concepts in Fortran95

Lecture 7: Data Abstractions

Database Management Systems MIT Lesson 01 - Introduction By S. Sabraz Nawaz

Abstract Data Types. Stack. January 26, 2018 Cinda Heeren / Geoffrey Tien 1

CPS352 Lecture - Indexing

CS 405G: Introduction to Database Systems

Higher National Unit specification: general information

Software and Programming 1

Access 2016 Module 7: Enhancing Forms

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Data Structure Lecture#22: Searching 3 (Chapter 9) U Kang Seoul National University

BBM371- Data Management. Lecture 1: Course policies, Introduction to DBMS

Boca Raton Community High School AP Computer Science A - Syllabus 2009/10

Object-Oriented Design and Analysis

List ADT. Announcements. The List interface. Implementing the List ADT

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Access - Introduction to Queries

External Sorting. Chapter 13. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

CSI33 Data Structures

Unit - IV CHAPTER - 13 INTRODUCTION TO OOP WITH C++ Part 1 Choose the best answer

Database Design. 1-2 Data vs. Information. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

LING/C SC/PSYC 438/538. Lecture 3 Sandiway Fong

SME1013 PROGRAMMING FOR ENGINEERS

AP Computer Science A Syllabus

The Art of Data Structures Introduction. Richard E Sarkis CSC 162: The Art of Data Structures

Object-Oriented Software Construction

Conceptual Design with ER Model

LECTURE 17. Expressions and Assignment

Object Oriented Programming

Advanced Object Oriented PHP

Abstract Classes. Abstract Classes a and Interfaces. Class Shape Hierarchy. Problem AND Requirements. Abstract Classes.

Chapter 3 Function Overloading

CS34800 Information Systems

Repeat or Not? That Is the Question!

Review: Memory, Disks, & Files. File Organizations and Indexing. Today: File Storage. Alternative File Organizations. Cost Model for Analysis

Chapter 5: Physical Database Design. Designing Physical Files

Java Software Solutions for AP Computer Science 3rd Edition, Lewis et al. 2011

Stacks and Queues. Introduction to abstract data types (ADTs) Stack ADT. Queue ADT. Time permitting: additional Comparator example

CMPT Data and Program Organization

MIT Database Management Systems Lesson 03: Entity Relationship Diagrams

DATABASE MANAGEMENT SYSTEM COURSE CONTENT

A Walkthrough of the Learning Aids

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!

Relational Database: The Relational Data Model; Operations on Database Relations

The Specification Phase

Chapter 7: Entity-Relationship Model

Database Management Systems (COP 5725) (Spring 2007)

CMPT 354: Database System I. Lecture 4. SQL Advanced

Overview of the ECE Computer Software Curriculum. David O Hallaron Associate Professor of ECE and CS Carnegie Mellon University

Database Applications (15-415)

CSE 331 Midterm Exam 2/13/12

Chapter 1: An Overview of Computers and Logic

School of Computer Science Computer Science (CS) Modules

CSCI312 Principles of Programming Languages!

VS2010 C# Programming - DB intro 1

Lecture 1. Abstraction

This lecture. Iterators ( 5.4) Maps. Maps. The Map ADT ( 8.1) Comparison to java.util.map

Assessment of Programming Skills of First Year CS Students: Problem Set

Computer Science II (Spring )

13 File Structures. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

COMP 250. Lecture 26. maps. Nov. 8/9, 2017

Outline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations

Standard ADTs. Lecture 19 CS2110 Summer 2009

Architectural Styles. Reid Holmes

COMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University

Introduction to Computers and Programming Languages. CS 180 Sunil Prabhakar Department of Computer Science Purdue University

CMSC131. Library Classes

Topic 1: Introduction

Abstract Data Types. CS 234, Fall Types, Data Types Abstraction Abstract Data Types Preconditions, Postconditions ADT Examples

Unit1: Introduction. Database System Concepts, 6 th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use

Transcription:

Data Structure Lecture#2: Data Structures and Algorithms U Kang Seoul National University U Kang (2016) 1

In This Lecture Learn what to consider in selecting right data structures Understand the need for ADT, and its difference from Data Structure Distinguish problem, algorithm, and program U Kang (2016) 2

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. U Kang (2016) 3

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. U Kang (2016) 4

Efficiency Choice of data structure or algorithm can make the difference between a program running in a few seconds or many days. 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. U Kang (2016) 5

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. U Kang (2016) 6

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. U Kang (2016) 7

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 a task. Bank example: Start account: a few minutes Transactions: a few seconds Close account: overnight U Kang (2016) 8

Some Questions to Ask Are all data inserted into the data structure at the beginning, or are insertions interspersed with other operations? (examples?) Can data be deleted? Are all data processed in some well-defined order, or is random access desired? E.g., Update all human names from Firstname Lastname format to Lastname, Firstname format in a document collection E.g., look up previous fellowship information of a student L U Kang (2016) 9

Selecting Data Structure Students previous GPA scores are located in the school s database Task 1) Find all students whose GPA is B0 at Spring 2016 This is called exact query. Hash table is appropriate. Task 2) Find all students whose GPA is between 0.0 ~ 2.0 This is called range query. B-tree is appropriate. U Kang (2016) 10

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. U Kang (2016) 11

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. U Kang (2016) 12

Why do we need ADT? 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. Why do we need ADT? U Kang (2016) 13

Metaphors An ADT manages complexity through abstraction Hierarchies of labels E.g., file => file manager => database In a program, implement an ADT, then think only about the ADT, not its implementation. You should learn how to think with ADT one sentence exercise U Kang (2016) 14

Logical vs. Physical Form Data items have both a logical and a physical form. Logical form: definition of the data item within an ADT. E.g., Integers in mathematical sense: +, - Physical form: implementation of the data item within a data structure. E.g., 16/32 bit integers, overflow. U Kang (2016) 15

Data Type ADT: Type Operations Data Items: Logical Form Data Structure: Storage Space Subroutines Data Items: Physical Form U Kang (2016) 16

Example A typical database-style project will have many interacting parts. U Kang (2016) 17

Problem, Algorithm, and Program (1) Problem: task to be performed Requires input and output E.g., given large collection of web documents, find all documents containing Korea Not include how the problem is to be solved U Kang (2016) 18

Problem, Algorithm, and Program (2) Algorithm: method or process to solve a problem A problem may be solved with more than one algorithm Property Algorithm must be correct Algorithm is composed of a series of concrete steps Algorithm has no ambiguity as to which step will be performed next Algorithm must contain a finite number of steps Algorithm must terminate U Kang (2016) 19

Problem, Algorithm, and Program (3) Program: instance, or concrete representation of an algorithm in some programming language E.g. java implementation of a hash table U Kang (2016) 20

Questions? U Kang (2016) 21