Download ESc101: (Linear, Circular, Doubly) Linked Lists, Stacks, Queues

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
4/16/2012
printf("Inserting after\n");
Inserting after
scanf("%d", &v);
while (v != -1)
{
q = create_node(v);
scanf("%d",
f("%d" &
&a);
)
p = head;
while ((p != NULL) && (p->data != a))
p = p->next;
if (p != NULL)
{
q->next = p->next;
p->next = q;
}
scanf("%d", &v);
}
print_list(head); /*Display the data in the list*/
an element
Krithika Venkataramani ([email protected])
19
Deleting from the end
printf("Deleting from end\n");
if (head != NULL)
{
p = head;
while (p->next != NULL)
{
q = p;
p = p->next;
}
q->next = NULL;
free(p);
}
print_list(head); /*Display the data in the list*/
Krithika Venkataramani ([email protected])
20
10
Related documents