Back to List

What is a Data Structure β€” and Why is it Important?

Understand what a data structure is and why performance can vary depending on how the same data is stored.

Beginner
|
5min
|
Verified (2026-07)
Progress0/23 (0%)

What is a Data Structure β€” and Why is it Important?

After completing this topic:

You will be able to explain what a data structure is and understand why "how you store data" determines a program's performance.


Same Data, Different Performance

Let's consider a phone book with 1,000 names and phone numbers.

Method A: Write them randomly on a piece of paper.

  • To find "Kim Hoon"? β†’ Check one by one from the beginning. In the worst case, 1,000 times.

Method B: Sort them alphabetically.

  • To find "Kim Hoon"? β†’ Open to the middle and compare, narrowing it down by half. Find it in a maximum of 10 attempts.

The data is the same. Only the way it is stored and organized is different, but the search speed differs by a factor of 100.

This is the essence of a Data Structure β€” the efficiency of operations depends on how the data is organized.


Basic Types of Data Structures

text
Linear Data Structures (arranged in a line)
β”œβ”€β”€ Array β€” Stored sequentially in contiguous memory locations
β”œβ”€β”€ Linked List β€” Each element points to the next
β”œβ”€β”€ Stack β€” Last-in, first-out (LIFO)
└── Queue β€” First-in, first-out (FIFO)

Non-linear Data Structures (branching structures)
β”œβ”€β”€ Tree β€” Hierarchical structure
β”œβ”€β”€ Graph β€” Free connections
└── Hash Table β€” Direct access by key

Why Can't We Just Use One?

If arrays were all-powerful, we wouldn't need other data structures. However, each structure has its strengths and weaknesses.

OperationArrayLinked ListHash Table
Access by indexFastSlowβ€”
SearchSlowSlowFast
Insertion/DeletionSlowFastFast

"This program performs a lot of searches, so use a hash table"; "Order is important, so use an array" β€” choosing the right data structure for the situation is up to the programmer.


Data Structure + Algorithm = Program

There is a famous formula:

Program = Data Structure + Algorithm β€” Niklaus Wirth (creator of the Pascal language)

A data structure is the container for data, and an algorithm is the method for processing data in that container. Using a good container with a good recipe results in an efficient program.


Why is it Important in Practice?

python
# Searching in a list β€” O(n), slow for large datasets
users = ["Kim Hoon", "Lee Soo", "Park Jin", ...] # 1 million users
"Kim Hoon" in users # Worst case: 1 million comparisons
# Searching in a dictionary (hash table) β€” O(1), almost instant
users = {"Kim Hoon": "010-1234", "Lee Soo": "010-5678", ...}
users["Kim Hoon"] # Found in one step

With 1 million users, choosing the right data structure can mean the difference between 1 million operations vs. 1 operation. This is why you need to learn data structures.


πŸ’¬ Questions & Comments

0 comments

You can post without signing in. Guest comments cannot be edited or deleted by their author.

0/2000

Loading...