Log in Sign up
Back to Discover
💻

Data structure

technology Maturity 11-13

Computers use special ways to store things.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg
These ways help find things fast. It is like a tidy toy box. This helps the computer work well. It makes everything easy to find. Can you find your toys fast?

48 words

Computers need to store lots of things.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg
They use special ways to keep things tidy. These ways are called data structures. One way is an array. This keeps things in a neat line.
Python 3. The standard type hierarchy-en.svg
Python 3. The standard type hierarchy-en.svg
Another way is a tree. A tree has parts that branch out. Some ways help find things very fast. This helps the computer do its work well. It makes large amounts of data easy to use.

85 words

Computers need to stay organized. They use a data structure to store information. A data structure is a way to arrange and keep data.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg
This helps computers find things quickly. Different tasks need different kinds of structures.

One type is an array. An array keeps items in a specific order. You can find an item using its index. An index is a number that shows its place.

Python 3. The standard type hierarchy-en.svg
Python 3. The standard type hierarchy-en.svg
Another type is a linked list. This is a group of nodes. Each node has a value and points to the next one. You can add or remove items easily in a list.

Some structures help with specific jobs. A hash table uses a math rule to find values fast. These are used in dictionaries. A tree organizes data in branches. One part is called the root. Trees are great for searching. Finally, graphs use nodes and edges. Edges are connections between nodes. Graphs can show how people are linked in social networks.

176 words

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.svg
Hash table 3 1 1 0 1 0 0 SP.svg
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.svg
Python 3. The standard type hierarchy-en.svg
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.svg
Hash table 3 1 1 0 1 0 0 SP.svg
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.svg
Python 3. The standard type hierarchy-en.svg
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.svg
Hash table 3 1 1 0 1 0 0 SP.svg
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.

465 words

A data structure is a specialized format for organizing and storing data values. It is more than just a list of information. It defines the relationships between data values and the specific operations that can be applied to them. In computer science, these structures act as an algebraic structure about data. They serve as the essential foundation for abstract data types (ADT). While an ADT defines the logical form of a data type, the data structure provides its physical implementation. Efficient data structures are vital for designing efficient algorithms. They allow computers to manage massive amounts of information, such as large databases or internet indexing services.

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

To understand how they work, we must look at how they interact with computer memory. Computers use a pointer to fetch and store data at specific locations. A pointer is a bit string that represents a memory address. This address can be stored in memory and manipulated by a program. Data structures generally fall into two implementation categories based on these pointers. Array and record structures use arithmetic operations to compute the addresses of data items. In contrast, linked data structures store the addresses of data items directly within the structure itself. This distinction has massive implications for how well an algorithm can scale. For example, contiguous memory allocation in arrays allows for very rapid access and modification.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg

There are many distinct types of data structures, each suited to different tasks. An array is a collection of elements in a specific order. Elements are usually of the same type and are accessed using an integer index. A linked list is a linear collection of nodes. Each node contains a value and a pointer to the next node. While arrays allow for fast random access, linked lists allow for efficient insertion and removal of values. Records, also called tuples or structs, are aggregate structures. They contain a fixed number of values indexed by names, which are called fields.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg

Other structures are designed for specialized logic and speed. Hash tables, or hash maps, provide fast retrieval of values using keys. They use a hashing function to map keys to indexes in an array. This allows for constant-time access in most average cases. However, they must sometimes handle hash collisions using techniques like chaining or open addressing. Graphs represent relationships between entities using nodes, called vertices, and connections, called edges. Graphs can be directed or undirected, and they may contain cycles. Trees provide a hierarchical organization. A tree starts with a root node, and all other nodes form subtrees. A special type of tree called a trie, or prefix tree, is used for string retrieval. This is how autocomplete and spell-checking functions work.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg

Abstract data types can be implemented using different physical structures. For instance, stacks and queues are common abstract data types. A stack follows the Last In, First Out (LIFO) principle. It uses two main operations: push to add an element to the top, and pop to remove it. A queue follows the First In, First Out (FIFO) principle. It uses enqueue to add an item to the rear and dequeue to remove it from the front. Both stacks and queues can be built using either arrays or linked lists. This shows how the physical implementation changes the way the logical type behaves.

Hash table 3 1 1 0 1 0 0 SP.svg
Hash table 3 1 1 0 1 0 0 SP.svg

The history of programming languages shows how support for these structures has evolved. Low-level assembly languages and languages like BCPL often lack built-in support for data structures. However, many high-level languages include special syntax for them. The C language supports structs and vectors, which are one-dimensional arrays. Pascal supports records. Most modern languages provide standard libraries so programmers do not have to rewrite them. Examples include the C++ Standard Template Library and the Java Collections Framework. These libraries allow for modular programming. In object-oriented languages like Java or C++, classes are used to create opaque data types. This allows a programmer to hide the complex implementation details from the user.

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

Data structures connect deeply to many different fields of computing. They are used in relational databases through B-tree indices for data retrieval. In compiler implementations, hash tables are used to look up identifiers. Some structures even have concurrent versions. These allow multiple computing threads to access a single instance of the data structure at the same time. Whether it is a simple array or a complex B-tree, the choice of structure dictates the performance of the entire system. By choosing the right organization, developers can ensure that software remains fast and scalable as data grows.

805 words
🖼️ 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
Up Next
💻
Hash table
Technology
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.