0

What is the importance of a counter in a linked list? what would happen if one left the counter out of the linked list?

2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by zeroliken
0

It makes the sorting, searching, manipulating a list a lot easier
like implementing binary search trees, AVL, heaps, graphs, search algorithms.

Edited by zeroliken

0

what would happen if there was no counter though? would the linked list still perform normally?

0

what would happen if there was no counter though? would the linked list still perform normally?

well javawise theres a class given that does the counter for you.
But if you want to do it manually (like in C, etc.) the data in each structure acts as the counter for the linked list(usually numeric) so more often than not there's a counter for every linked list. but even if there is an event where no sortable data can be found I guess that as long as each item is connected then yes it should still act like a linked list

what exactly are you suppose to do with the linked list?

Edited by zeroliken

0

Discuss the effect on all the operations if there were not a count variable in the implementation.

This is dealing with linked lists. every time a new node is placed into the list the counter goes up by 1.

0

looking at the methods of the class all data manipulation of an element using the index should become impossible

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.