Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are linked lists implemented without the use of pointer?

Tags:

java

c++

It is easy to implement linked list in c++ where you have pointers. But how are they implemented in other languages (like java,python,etc). I don't want to use built-in class(which are supported in JAVA) for linked-list but what i want is how to replace pointers to create linked-list?

like image 950
mak04 Avatar asked Aug 24 '12 18:08

mak04


1 Answers

They are implemented using references which are essentially (excluding syntax) pointers that you can't do pointer arithmetic with (in some languages they also can't be null). In many languages, references are the default way of using variables, unlike C++ where the default is by-value.

like image 80
Dirk Holsopple Avatar answered Dec 27 '22 07:12

Dirk Holsopple