In graph theory, a tree is an undirected graph in which any two vertices are connected by exactly one path, or equivalently a connected acyclic undirected graph.
Which perfectly applies to a linked list:
Any two list elements are connected by exactly one path
There are no loops in a list
There's even a whole programming language that pretty much implements linked lists as a special case of binary trees (That's lisp I'm talking about), and you could easily do the same in any other programming language that implements trees.
I think we are also learning new stuffs in the process, maybe the resources that I was using in my research were not clear 😅. And they have given me a new Friend called DarkWiiPlayer
By the way it may seem like a technicality but it's actually a really cool thing. So many things can be thought of as special kinds of graphs so learning a thing or two about those can be immensely helpful in so many programming problems 😁
So we agree that linked lists are both linear and non linear. And when using the definition of seuqnetiality would a tree not be linear because there is topological ordering from the root to leaves?
But... linked lists are literally trees though; they can't be linear and non-linear at the same time 😂
EDIT: That image is nice, but wrong. Trees are just (connected) graphs without loops, so every linked list is also a tree.
I'll just quote wikipedia here:
Which perfectly applies to a linked list:
There's even a whole programming language that pretty much implements linked lists as a special case of binary trees (That's lisp I'm talking about), and you could easily do the same in any other programming language that implements trees.
I think we are also learning new stuffs in the process, maybe the resources that I was using in my research were not clear 😅. And they have given me a new Friend called DarkWiiPlayer
Yaaay!
By the way it may seem like a technicality but it's actually a really cool thing. So many things can be thought of as special kinds of graphs so learning a thing or two about those can be immensely helpful in so many programming problems 😁
So we agree that linked lists are both linear and non linear. And when using the definition of seuqnetiality would a tree not be linear because there is topological ordering from the root to leaves?
that's more clear, thanks