Documente Academic
Documente Profesional
Documente Cultură
FTI
Materi Kuliah
1. Tinjauan umum Struktur Data
2. Array, Record dan Pointer 3. Linked List
FTI
Pokok Bahasan
1. Pengantar 2. Array 3. Record & Pointer 4. Link List 5. Stack 6. Queue 7. Recursi 8. Ujian Tengah Semester 9. Tree
FTI
Pokok Bahasan
10. Aplikasi Tree 11. Graph 12. Algoritma Warshall 13. Graph dengan Link-list 14. Sorting & Searching 15. Review seluruh materi 16. Ujian Akhir Semester
FTI
Referensi
FTI
Referensi
FTI
Referensi
FTI
Referensi
FTI
Referensi
FTI
that we can produce good-quality computer code By good-quality, we mean a program that is efficient, which solves a problem within its resource constraints (space, time) One cannot become a computer professional without good knowledge of these algorithms and data structures A data structure organizes information An algorithm manipulation information.
FTI
algorithm
Algorithm: a set of well-defined rules for solution of a problem
An algorithm takes the input to a problem and transforms it to the
output which solves the problem A problem can have many algorithms. An algorithm possesses the following properties: It must be correct It must be composed of precisely defines steps The order of the steps must be precisely defined It must be composed of a finite number of steps It must terminate for all inputs
A computer program is an instance, or concrete representation, for an algorithm in some programming language
FTI
Data structures
A type is a set of values.
e.g. Integer, Boolean A data type is a type and a collection of operations that manipulate the type e.g. Addition A data item is a member of a data type A data item is piece of information (a physical instantiation of a data type)
FTI
simple: Integer, Real, Char, Boolean Aggregate: Array, Record Aggregate data type is an example of a data structure it consist of:
Simple member Relationship among the members Operation on the data structure that allow the
FTI
(e.g. Array, string) Many other data structures are often needed and they can be implemented using the built-in data structures These are called user-defined data structures In Pascal, we use record to define data structures Organized data in logical or mathematical model of a particular organization of data. It must be rich enough in structure to mirror the actual relationship of the data in the real world The structure should be simple enough that one can effectively process the data when necessary.
FTI
referenced respectively by a set of n consecuitive numbers Linked list: a linier collection of data items. Stack: a list of elements in which an element may be inserted or deleted only at one end, called the top of the stack Queue: a list of elements in which deletions can take place only at one end, called the front, and insertion can take place only at the other end, called the rear.
FTI
between various elements. Graph: data structure that contain a relationship between pairs of elements which is not necessarily hierarchical in nature.
FTI
in the record may be processed Searching: finding the location of the record with a given key value or finding the location of all records which satisfy one or more conditions. Inserting: adding a new record to the structure Deleting: removing a record from the structure Sorting: arranging the records in some logical order Merging: combining the records in two different sorted file into a single sorted file
FTI
Array
Linier data structure: its element form a sequence or a
linier list Elements of the array are referenced respectively by an index set consisting of n consecutive numbers Elementss of the array are stored respectively in successive memory location The number n of elements is called the length or size of the array Length=UB-LB+1 *UB:Upper Bound, LB: Lower Bound
FTI
FTI
FTI
[initial counter] Set J := N. Repeat steps 3 and 4 while J >= K [move Jth element downward] Set LA[J+1]:= LA[J] [Decrease counter] Set J := J-1 [End of Step 2 loop] [Insert element] Set LA[K]:= ITEM [Reset N] Set N := N+1 Exit
FTI
3. 4.
Set ITEM := LA[K]. Repeat for J := K to N-1 [move J+1th element upward] Set LA[J]:= LA[J+1] [Decrease counter] Set J := J-1 [End of loop] [Reset the number N of elements in LA] Set N := N-1 Exit
FTI
[Initialize segment variable] Set BEG:=LB, END:=UB and MID:=INT(BEG+END)/2 Repeat steps 3 and 4 while BEG<=END and DATA[MID] <>ITEM If ITEM < DATA[MID] then Set END := MID-1 Else Set BEG := MID + 1 Set MID := INT((Beg+END)/2) [End of Step 2 loop] If DATA[MID]=ITEM then set LOC:= MID Else Set LOC:= NULL Exit
FTI