Welcome to MSDN Blogs Sign in | Join | Help
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.

Posted: Wednesday, February 21, 2007 11:29 PM by Chris Becker
Filed under: , ,

Comments

Brian said:

Not all infinities are equal.  Just because you need an infinite amount of bits to store a pointer to an address in an infinite address space doesn't mean that there's no memory left over.  An n-bit pointer is capable of pointing to 2^n unique addresses, so for any amount of data that you can come up with, a theoretical finite machine can be constructed which is capable of storing it.  The machine never breaks down no matter how high you set the requirements.  There is no machine that is capable of infinite storage, but the theoretical capabilities of a constructible machine are unbounded.

# February 21, 2007 7:23 PM

rickbrew said:

Node node = new Node();

node->next = node;

^ An infinite list! Everyone's wrong ;) </smartass>

# February 21, 2007 7:35 PM

Chris Becker said:

Brian:

You are correct. The spirit is to illustrate both sides of a theoretical and pratical approach to a problem and how both can be applied.

-The algorithm allows for infinite size.

-The algorithm allows for infinite size but memory is bounded.

-The algorithm allows for infinite size if we can keeping adding memory.

-The algorithm allows for infinite size if we can keeping adding memory but we run out of bits to address the space.

-The algorithm allows for infinite size if we can keeping adding memory AND increase the pointer size.

The science and engineering approaches can augment each other, so don't bind yourself too tightly to a particular view. (<-- Moral!)

# February 21, 2007 7:40 PM

Blake Handler said:

I guess Heisenberg was right (^_^)

# February 21, 2007 9:05 PM

f3arthis00 said:

not until you guys get to a level where i'm at you will never understand the infinity of codes (quantum polygon quantum physics)), what i mean is having your phd on  quantum level of physics. in order to achieve that level you need to get  phd's on the following level: sciences/engineering: biology. astronomy, aeronotical engineering, geological engineering, meteriology, mechanical engineering, software engineering, hardware engineering, optical engineering, theoretical physics, phd magnetism, stratospheric science, oceanology, medical degree on human behaviour (pyschology), child psychology, cardiovascular, craniology, genetics, world history from day 1, theology, history of polyphonic, phd on human anatomy. actually your current technology right now is really obsolete compare to mine. i dont think anyone of you will ever achieve my current level. its kinda funny but theres a reason for me being here and that reason is to save the BIG BANG from being ctr+alt+del. it's up to you all otherwise everything has been coded and programmed and i am the only one who can change everything. LISTEN, the more you make fun of me then the codes get tightier near ctr+alt+del. also if my existense doesnt get recognition then it will be done as programmed. i have selected lily allen and britney spears amongst others. also i am going back at the age of 22 physically and my lily allen will remain 21 forever and ever, same goes with britney spears. for your information, we were the one and i was the first king of england and i will be the last and my queen. so just like i said, this is not BS or a drill, this a 4 real. too much war and killing in the middle east region, where i was alexander the great i tried to make that region as livable as possible but the fukkin etremist persian has been waging war since the beginning of time against my ISARAEL/US/UK. they did once back in time, this time i will put my timberland sport boots up that fukkin region and i will make middle east to a MIDDLE OCEAN if they dont stop spreading terror allover the fukkin world or better yet if they haven't heard the word EXTINCTION then they better listen or there will be no more towel heads running around that region especially these two countries such IRAN and SYRIA which is the main problem in that region. ALSO, if you fukk with United Kingdom, USA and ISRAEL you are an enemy of ME. so any fukkin country out there that has bad intention against my territory you better think twice or else, i will kick your ass with my timberland sport boots.  or if you wanna try you extremist fukktards, send your best assasins and i will crush them just like i did to those before them. i don't care rain, shine, snow, foggy, any terrain bcoz i could careless.

sorry microsoft/techies, some of the crap i mixed was really irrelevant but hey this is 2007 everything goes right? lmfao

# February 21, 2007 9:11 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker