-
Notifications
You must be signed in to change notification settings - Fork 0
/
linked_list.js
51 lines (44 loc) · 1.21 KB
/
linked_list.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// module.exports = {
// CreateList: function(time, patient_Id) {
// this.time = time;
// this.patient_Id = patient_Id;
// this.next = null;
// }
// Add_time: function(time, head, key) {
// var new_node = new CreateList(time, null);
// var current = head;
// while(key != current.time && current != null) {
// current = current.next;
// }
// if(current != null) {
// new_node.next = current.next;
// current.next = new_node;
// }
// else { //if there is no such node add it to last one
// new_node.next = null;
// current.next = new_node
// }
// }
// Update: function(id, head, time) {
// var current = head;
// while(current.time != time && current != null) {
// current = current.next;
// }
// if(current != null && current.patient_Id == null) {
// current.patient_Id = id;
// }
// else { console.log('This slot is already booked or is invalid'); }
// }
// removePatient: function(id, head, time) {
// var current = head;
// while(current.time != time && current != null) {
// current = current.next;
// }
// if(current != null) {
// if(current.patient_Id == id) {
// current.patient_Id = null;
// }
// else { console.log("Invalid patient_Id"); }
// }
// }
// }