MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / deleteList

Function deleteList

CPP/LINKED LIST/Linked_list.cpp:95–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void deleteList(struct Node *p , int index)
96{
97 struct Node *prev;
98
99 if(index == 0){
100
101 // pointing to 1st node
102 prev = first;
103
104 // pointing to 2nd node
105 first = first->next;
106
107 delete prev;
108 }
109
110 else{
111
112 for (int i = 0; i < index-1; i++)
113 {
114 prev = p;
115 p = p->next;
116 }
117
118 prev->next = p->next;
119 delete p;
120
121 }
122}
123
124struct Node *searchList(struct Node *p, int target)
125{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected