Data Structure and Algorithms CO2003 Chapter 1 Introduction

44 423 1
Data Structure and Algorithms CO2003 Chapter 1  Introduction

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Data Structure and Algorithms [CO2003] Chapter - Introduction Lecturer: Duc Dung Nguyen, PhD Contact: nddung@hcmut.edu.vn August 15, 2016 Faculty of Computer Science and Engineering Hochiminh city University of Technology Contents Basic concepts Revision Basic concepts What is Data? What is Data? Data Data is information that has been translated into a form that is more convenient to calculate, analyze Example • Numbers, words, measurements, observations or descriptions of things • Qualitative data: descriptive information, • Quantitative data: numerical information (numbers) • Discrete data can only take certain values (like whole numbers) • Continuous data can take any value (within a range) Data type Class of data objects that have the same properties Data type A set of values A set of operations on values Example Type integer floating point character Values Operations −∞, , −2, −1, 0, 1, 2, , ∞ −∞, , 0.0, , ∞ \0, , ‘A’, ‘B’, , ‘a’, ‘b’, , ∼ ∗, +, −, %, /, ++, −−, ∗, +, −, /, , Data structure What is a data structure? A combination of elements in which each is either a data type or another data structure A set of associations or relationships (structure) that holds the data together Example An array is a number of elements of the same type in a specific order 13 21 34 Abstract data type The concept of abstraction: • Users know what a data type can • How it is done is hidden Definition An abstract data type is a data declaration packaged together with the operations that are meaningful for the data type Declaration of data Declaration of operations Encapsulation of data and operations Abstract data type Figure 1: Abstract data type model (source: Slideshare) Example: List Interface • Data: sequence of elements of a particular data type • Operations: accessing, insertion, deletion Implementation • Array • Linked list Pointers p 1000 value 93 999 1000 1001 p = &v a l u e ; v a l u e = ∗p ; 27 Pointers Example i n t main ( ) { i n t v1 = , v2 = ; i n t ∗ p1 , ∗ p2 ; p1 = &v1 ; p2 = &v2 ; ∗p1 = ; ∗p2 = ∗p1 ; p1 = p2 ; ∗p1 = ; c o u t

Ngày đăng: 29/03/2017, 18:21

Từ khóa liên quan

Mục lục

  • Basic concepts

    • Data

    • Data type

    • Data structure

    • Abstract data type

    • Algorithm

    • Pseudocode

    • Revision

      • Data structures

      • Classes

      • Pointers

      • Arrays

      • Pointers to structures

      • Pointers to classes

Tài liệu cùng người dùng

Tài liệu liên quan