Chapter 3 Linear list
Chapter 3 Linear List
3.1 Preface 1. data object- a set of instances or values for example Booleanfalse, true) Digit={0,1,2,3,4,56,78,9} Letter-A B,..Z, a, b,...Z) NaturalNumber= 0, 1, 2,.. Integer={0,+1,-1,+2,-2,+3,-3,…} Stringa,b aa. ab. ac
3.1 Preface 1. data object--- a set of instances or values for example: Boolean={false,true} Digit={0,1,2,3,4,5,6,7,8,9} Letter={A,B,……Z,a,b,……z} NaturalNumber={0,1,2,……} Integer = {0, +1, -1, +2, -2, +3, -3, …} String={a,b,……,aa, ab, ac,……}
3.1 Preface 2. data structure is a data object together with the relationships among the instances and among the individual elements that compose an instance Data Structure=D, R) D---data object R-a set of relationships of all the data members in D
3.1 Preface 2.data structure is a data object together with the relationships among the instances and among the individual elements that compose an instance • Data_Structure={D,R} • D---data object, • R ---a set of relationships of all the data members in D
3.2 Linear list L=( list size is n if n=0: empty list ifn>o is the first'th(or front)element e. is the last element e; immediately precedes eit
3.2 Linear List L = (e1 , e2 , e3 , …, en ) list size is n if n=0: empty list if n>0: e1 is the first’th (or front) element en is the last element ei immediately precedes ei+1
3.2 Linear list Example Students=Jack, Jill, Abe, Henry, Mary. Judy) Exams=(examl, exam2, exam) Days of Week=(S, M, T, W, Th, F, Sa Months=(Jan, Feb, Mar, Apr,., Nov, Dec
3.2 Linear List Example: Students =(Jack, Jill, Abe, Henry, Mary, …, Judy) Exams =(exam1, exam2, exam3) Days of Week = (S, M, T, W, Th, F, Sa) Months = (Jan, Feb, Mar, Apr, …, Nov, Dec)