Eli5: explain data structure from computer science to a non technical person.

752 views

How do I explain what is data structure to someone who has never programmed before?

In: 15

17 Answers

Anonymous 0 Comments

Some data structures are named after real-world things.

A ‘stack’ is a metaphor for a real-world stack of items. Imagine a stack of pages. You can only access the top page. Notable, the first item to be placed in the stack is at the bottom, meaning it is always the furthest away from you. Also, the latest page to be left on the stack is on top for you to see.

A ‘queue’ is a metaphor for a real-world queue, where whatever was added to the queue first will get looked at first, and whatever was added last will be looked at last.

In computer science, we make these things extremely strict. Like with a real-world stack of papers, if you wanted to sneak a peak at the middle page, you could. Or with a real-world queue, someone might barge in and skip to the head of the line. In computer science, we instead pretend that these rules are never broken. The stack is only ever accessed at the top of it, both to add and remove data, and we can only ever add to the back of a queue and take from its front.

Making sure that things follow these rules can be helpful for some programs.

You might think you should just let everything be accessible at all times for the sake of convenience, but this can get confusing (or unsecure), and sometimes knowing for sure that something follows these rules is helpful for working out how to reat the data that comes in that way.

In computer science, we use data structures like this to help us. We also sometimes invent new data structures that don’t have a real-world metaphor, but do have some digital properties we like.

You are viewing 1 out of 17 answers, click here to view all answers.