Postingan

Menampilkan postingan dari Februari, 2018

pert ke 2 - Linked List Implementation I - 2101680123 - MILLIADY KUSNADI THE BU HIAP

Linked List Implementation I A.    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; B.    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; C.    Single Linked List: Insert Append a new node in front of head. Assuming there is already a linked list containing 10, 35, 27. D....

Pert ke 1 - Pointer, Array and Introduction to Data Structure - 2101680123 - Milliady Kusnadi The Bu Hiap

Pointer, Array and Introduction to Data Structure A.    Array •          A collection of similar data elements •          These data elements have the same data type (homogenous) •          The elements of the array are stored in consecutive memory locations and are referenced by an index •          Array index starts from zero *Array Declaration & Accessing Array Declaration: •       int arr[5]; Accessing: •       arr[0] = 7; •       arr[1] = 2; •       arr[2] = 13; •       arr[3] = 13; •       arr[4] = 13; *Array Declaration & Accessing Array Two Dimensional Array Declaration : •       int arr...