Lab Exercises 4: Linked List: Learning Outcomess
Lab Exercises 4: Linked List: Learning Outcomess
LEARNING OUTCOMESS
Room Event
Number
3 Meeting_X
5 Workshop_Y
6 Training_I
8 Conference_A
Figure 4.1
References
Tasks:
Re-draw Figure 4.2 as a linked-list illustration based on Figure 4.1. Give your own
appropriate value for the memory address of the node.
POINTER
[200]
NULL
Figure 4.2
Tasks:
Re-draw Figure 4.2 to illustrate insert at the begin after the following operation,
FSKKP needs one room for Workshop_J at room 2.
The hotel allocated one room for Special_VVIP occasion at room 10.
Tasks:
Build a complete C program to represent the list of event. Your program must be
developed based on your illustration in Exercise 4.1 – 4.2. The program must be
capable to handle user input from keyboard and using insertion at the begin of the
list. The final output of your program is as shown in Figure 4.3.
References
Enter choice: l
Room number Event
10 VVIP
2 Workshop_J
3 Meeting_X
5 Workshop_Y
8 Training_I
6 Conference_A
Figure 4.3
Room Patient
number number
1 3001
3 1001
4 2001
6 5001
Figure 4.4
References
Tasks:
Re-draw Figure 4.5 as a linked-list illustration based on Figure 4.4. Give your own
appropriate value for the memory address of the node.
POINTER
NULL
Figure 4.5
Tasks:
Re-draw Figure 4.5 to illustrate insert at the end after the following operation,
Patient no 3002 enter the room number 7
Patient no 1002 enter the room number 8
Tasks:
Build a complete C program to represent the list of patients’ number. Your program
must be developed based on your illustration in Exercise 4.4 – 4.5. The program must
be capable to handle user input from keyboard and using insertion at the end of the
list. The final output of your program is as Figure 4.6.
Enter choice: l
1 3001
3 1001
4 2001
6 5001
7 3002
8 1002
Figure 4.6
Tasks:
Re-draw Figure 4.5 to illustrate insert at the middle after the following operation,
Patient no 2002 enter the room number 2
Patient no 5002 enter the room number 5
References
Tasks:
Build a complete C program to represent the list of patients’ number. Your program
must be developed based on your illustration in Exercise 4.7. The program is capable
to handle user input from keyboard and using insertion at the middle of the list.
Upon request from user, the program will ask user to enter the location of new
patient. The final output of your program is as Figure 4.7.
Enter choice: l
1 3001
2 2002
3 1001
4 2001
5 5002
6 5001
Figure 4.7
Room Student
number
1 Lucy
2 Tisha
5 Tania
7 Ida
8 Sara
10 Mona
12 Nadia
Figure 4.8
Tasks:
Based on Figure 4.8, build a complete linked list program to represent the list of
students. Create a function to input and display the information. For this task,
construct a function to delete a node at the begin of the list.
Tasks:
Save your program in Exercise 4.9 as another file name. Replace your previous delete
node function with a function to delete a node at the end of the list.
Tasks:
Save your program in Exercise 4.10 as another file name. Replace your previous
delete node function with a function to delete a node at the middle of the list.