Introduction Introduction Luong The Nhan, Tran Giang Son Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Classes Pointers Arrays Pointers[.]
Introduction Luong The Nhan, Tran Giang Son Chapter Introduction Basic concepts Data Data type Data Structures and Algorithms Data structure Abstract data type Algorithm Pseudocode Revision Data structures Luong The Nhan, Tran Giang Son Faculty of Computer Science and Engineering Ho Chi Minh University of Technology, VNU-HCM Classes Pointers Arrays Pointers to structures Pointers to classes 1.1 Introduction Overview Luong The Nhan, Tran Giang Son Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Classes Pointers Arrays Pointers to structures Pointers to classes Revision Data structures Classes Pointers Arrays Pointers to structures Pointers to classes 1.2 Introduction Luong The Nhan, Tran Giang Son Basic concepts Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Classes Pointers Arrays Pointers to structures Pointers to classes 1.3 Introduction What is Data? Luong The Nhan, Tran Giang Son Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Classes Pointers Arrays Pointers to structures Pointers to classes (Source: datorama.com) 1.4 Introduction What is Data? Data Luong The Nhan, Tran Giang Son Data is information that has been translated into a form that is more convenient to calculate, analyze Example Basic concepts Data • Numbers, words, measurements, observations or descriptions of things Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Classes • 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) Pointers Arrays Pointers to structures Pointers to classes 1.5 Introduction Data type Luong The Nhan, Tran Giang Son Class of data objects that have the same properties Data type A set of values A set of operations on values Basic concepts Data Data type Data structure Abstract data type Example Type integer floating point character Algorithm Pseudocode Values −∞, , −2, −1, 0, 1, 2, , ∞ −∞, , 0.0, , ∞ \0, , ‘A’, ‘B’, , ‘a’, ‘b’, , ∼ Operations ∗, +, −, %, /, ++, −−, ∗, +, −, /, , Revision Data structures Classes Pointers Arrays Pointers to structures Pointers to classes 1.6 Introduction Data structure Luong The Nhan, Tran Giang Son 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 Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Example Revision An array is a number of elements of the same type in a specific order Data structures Classes Pointers Arrays Pointers to structures Pointers to classes 13 21 34 1.7 Introduction Abstract data type Luong The Nhan, Tran Giang Son The concept of abstraction: • Users know what a data type can • How it is done is hidden Basic concepts Data Data type Definition Data structure Abstract data type An abstract data type is a data declaration packaged together with the operations that are meaningful for the data type Algorithm Pseudocode Revision Data structures Classes Pointers Arrays Declaration of data Declaration of operations Encapsulation of data and operations Pointers to structures Pointers to classes 1.8 Introduction Abstract data type Luong The Nhan, Tran Giang Son Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Classes Pointers Arrays Pointers to structures Pointers to classes Figure: Abstract data type model (source: Slideshare) 1.9 Introduction Example: List Luong The Nhan, Tran Giang Son Interface • • Data: sequence of elements of a particular data type Operations: accessing, insertion, deletion Basic concepts Data Data type Data structure Abstract data type Algorithm Pseudocode Revision Data structures Implementation Classes Pointers Arrays Pointers to structures • • Array Linked list Pointers to classes 1.10 ... (like whole numbers) • Continuous data can take any value (within a range) Pointers Arrays Pointers to structures Pointers to classes 1.5 Introduction Data type Luong The Nhan, Tran Giang Son Class... Statement constructs: sequence, selection, iteration 1.13 Introduction Pseudocode: Example Luong The Nhan, Tran Giang Son Algorithm average Pre nothing Post the average of the input numbers is printed... type, object_names can be a set of valid identifiers for objects that have the type of this structure • Within braces { }, there is a list with the data members, each one is specified with a type