Scientists and Engineers are Wrong!
Say the following question was on a Computer Science exam:
Are you an Engineer or a Scientist? Explain.
What would you put?
I'll give you a bit of hint by your answer to this question:
How much information can you store in linked list?
1. Infinite - Linked lists have no end and so can store any amount
2. Finite – Linked lists are limited to how much RAM is available.
Linked lists have no end and so can store any amount
Theoretically there is no limit to the linked list structure. If you want to put more data on it you just make the last node point to a new node and then that new node is the last node. Tada! The linked list is one node longer. Rinse and repeat.
This is the science answer. Conceptually this is how the linked list structure works, the mechanics of how it's implemented or the machine it's executed on are irrelevant.
Linked lists are limited to how much RAM is available.
No matter how magical your data structure algorithm is, you always have to worry about how much RAM you have. You can't add a new node if you don't have space.
This is the engineer answer. If you can't fit your idea in the box, then it's no good to anyone.
Trick Question
Now that you have a grasp of which group you fit in, can you see why the above is a trick question?
Neither option is entirely correct; take a look at the linked list structure:
struct Node
{
DATA data;
Node* next;
};
The engineering answer is incomplete because we need to store next in the structure. So at most (neglecting the OS and other programs), we can't store all information we want in RAM. We can store Available_Ram–sizeof(Node*)*Number_of_Nodes. A scientist would argue we could still increase the available virtual RAM through the hard disk or simply by adding more RAM to the machine. The science answer is still possible.
The engineer then says there's a very fundamental problem with the pointer next. On a 32-bit system, sizeof(Node*)is 4 bytes, on 64-bit it's 8 bytes. What happens if you keep adding and adding nodes? Eventually, you've filled up all available addresses that a pointer can point to! The most bytes we can point to with a 4 byte pointer is 4 gigabytes. With a 64-bit, 8 byte pointer it's 4 gigabytes squared; a very, very large number, but still a finite number. Theoretically then, the scientist says, if we have an infinite amount of RAM we would need an infinite sized pointer to address it all.
The moral of the story: neither the science nor the engineering answer will ever give you the complete story. Consider both approaches when making technical decisions about trade-offs related to a particular problem's solution.