Nepedia
Back to Discover
Fluent Reader
💻

Data structure

technology Maturity 11-13 Next article →

Computers handle huge amounts of information every single day. To stay organized, they use something called a data structure. A data structure is a specific way to arrange and store data values. It also defines how those values relate to each other.

Hash table 3 1 1 0 1 0 0 SP
Hash table 3 1 1 0 1 0 0 SP

This organization is vital for making software work well. Without these structures, finding information would be a very hard job. Good structures help computers manage large databases and internet indexes efficiently.

How a data structure works depends on how it uses memory. Computers use a pointer to find data in different places. A pointer is a bit string that acts like a memory address.

Python 3. The standard type hierarchy-en
Python 3. The standard type hierarchy-en

Some structures, like arrays, use math to find these addresses. Arrays keep items in a specific order in a single block of memory. This makes it very fast to access or change items. Other structures, like linked lists, store the address of the next item inside the current one. This makes it easy to add or remove items without moving everything else.

Many different types of structures exist for different tasks. An array uses an integer index to find a specific element. A record, also called a struct, holds several values together using names.

Hash table 3 1 1 0 1 0 0 SP
Hash table 3 1 1 0 1 0 0 SP

Hash tables use a hashing function to find values very quickly. These are great for dictionaries or database indexing. Trees organize data in a hierarchy starting from a single root node. Graphs use nodes and edges to show connections between different things. You might see graphs used to model social networks or computer networks.

Programmers use many tools to build these structures. Some languages like C and Pascal have built-in support for records and arrays.

Python 3. The standard type hierarchy-en
Python 3. The standard type hierarchy-en

Other languages use standard libraries to provide common structures. Examples include the Java Collections Framework and the C++ Standard Template Library. Some very low-level languages, like BCPL, do not have built-in support. Most modern languages allow programmers to hide the hard details of how a structure works. This is often done using classes in object-oriented languages like Smalltalk.

You can see these ideas in things you use every day. A stack of plates works like a stack data structure. It uses a principle called Last In, First Out, or LIFO. You add a plate to the top and take it from the top. A queue of people is like a different structure. It follows the First In, First Out rule, or FIFO.

Hash table 3 1 1 0 1 0 0 SP
Hash table 3 1 1 0 1 0 0 SP

A trie is a special tree used for autocomplete on a phone. It helps the computer find words based on the first few letters you type.

427 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (2)
File:Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg
File:Python 3. The standard type hierarchy-en.svg
Python 3. The standard type hierarchy-en.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.