Data Structure - Traversing a linked list

Traversing is nothing but, accessing each record exactly once.
In simple manner we can say that traversing is nothing but visiting or accessing each record of data structure.

ALGORITHM FOR TRAVERSING A LINKED LIST

As we can see in above algorithm the traversing of linked list is properly described in easy manner.
In the first step of algorithm we have set pointer to the start location.
Here we have to use while loop, which will goes continue till null pointer reached.
Now we have to access each and every element/node of linked list named INFO to increase the counter we are putting link of next element into the ptr.
So that the loop will go to next position.
In this way each & every element of linked list will be accessed & final step is Exit.

Comments

Popular posts from this blog

Theory part introduction

Data structure - Sorting methodes