AlgoPlus//structures / file-allocation
Read the theory

File Allocation

How a file's blocks are laid out on disk — contiguous, linked, or indexed.

Method
Contiguous
Files
0
Step
1/1
Method
Legend
Data block
Index block
Free block
AI Tutor Workspace
In a nutshell
A file's data is stored in fixed-size disk blocks, and there are three ways to keep track of which blocks belong to it. Contiguous puts them in one unbroken run — fast, but it leaves gaps as files come and go. Linked scatters them anywhere, each block pointing to the next — no gaps, but you can't jump to the middle. Indexed keeps one extra block listing all the others — fast jumps, at the cost of that index block.
Ready
Press play to begin the cinematic walkthrough.
How a file is laid out on disk is a tradeoff: contiguous is fast but fragments; linked never fragments but forbids random access; indexed gives random access through one extra index block.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for File Allocation.