Postingan

Menampilkan postingan dari Februari, 2018
Gambar
Materi Pertemuan 3 COMP6048 – Data Structure Linked List Implementation I Single Linked List To create a list, we first need to define a node structure for the list. Supposed we want to create a list of integers. struct tnode {             int value;             struct tnode *next; }; struct tnode *head = 0; Notes : “head” adalah pointer menuju ke elemen pertama pada linked list. Single Linked List: Insert To insert a new value, first we should dynamically allocate a new node and assign the value to it and then connect it with the existing linked list. Supposed we want to append the new node in front of the head . struct tnode *node =             (struct tnode*) malloc(sizeof(struct tnode)); node->value = x; node->next  = head; head = node; Notes: Oper...
Gambar
Materi Pertemuan 2 COMP6048 – Data Structure Introduction to Linked List ·        Structure o     Structure  is basically a user-defined data type that can store related information (even of different data types) together, while an array can store only entities of same data types. o     It is a collection of variables under a  single   name . o     The variables within a structure are of  different data types  and each has a name that is used to select it from the structure. ·         Structure Declaration struct  tdata  {             int   age;             char  name[100];             float score; }; not...
Gambar
     Materi Pertemuan 1 COMP6048 – Data Structure Pointer, Array and Introduction to Data Structure 1. Array     Array adalah Kumpulan elemen data yang serupa.     Sifat-sifat array: Elemen data ini memiliki tipe data yang sama/sejenis (homogen) Elemen-elemen array disimpan di lokasi memori berturut-turut dan direferensikan oleh sebuah indeks Indeks Array dimulai dari nol     Array Declaration & Accessing Array     Setiap array memiliki dimensi array yang berbeda-beda dan maksimal dimensi yang dapat dimiliki oleh satu variabel adalah    standar merekomendasikan penerapan untuk menerima setidaknya 256 (ISO 14882, B.2), namun mereka mungkin mendukung lebih sedikit atau lebih:  (Thanks for the information from https://stackoverflow.com/questions/10738267/what-is-the-maximum-number-of-dimensions-allowed-for-an-array-in-c) Array Satu Dimensi Pernyataan:    ...