4 ms·
Suppose my data is a single letter, the letter 'x'. I might represent this data as (for example): 1. The integer 24, as x is the 24th letter of the alphabe
by nightcracker 6y ago
Suppose my data is a single letter, the letter 'x'. I might represent this data as (for example):
1. The integer 24, as x is the 24th letter of the alphabet.
2. A picture of a handwritten x.
3. The symbol x, as I did above.
4. The integer 120, as in ASCII.
All of these represent the same data, despite being different.
Data representation often has multiple layers. For example
that integer 120 from ASCII is then often represented as a single byte containing bits 01111000. The 'symbol x' has some unspecified representation. The picture might be represented using vector art, or an array of pixels, each with a color (which then requires[1] a representation for the colors).
Now suppose I'd want to write a function that gives the next letter after the symbol I'd give in. Choosing the right representation for your data can make this easy or hard.
For the example above, representations 1, 4 are very easy (simply increment the number of the representation by 1), 3 is somewhat easy, and 2 is highly impractical.
---
[1] I said something requires a representation. But this is only true when creating a concrete implementation. But while designing algorithms or systems it can often simplify things to simply think of the data, and not its representation.