Chapter 6

Structuring Data

IN THIS CHAPTER

check Defining why data requires structure

check Working with stacks, queues, lists, and dictionaries

check Using trees to organize data

check Using graphs to represent data with relations

Raw data is just that: raw. It’s not structured or cleaned in any way. You might find some parts of it missing or damaged in some way, or simply that it won’t work for your problem. In fact, you’re not entirely sure just what you’re getting because it’s raw.

Before you can do anything with most data, you must structure it in some manner so that you can begin to see what the data contains (and, sometimes, what it doesn’t). Structuring data entails organizing it in some way so that all the data has the same attributes, appearance, and components. For example, you might get data from one source that contains dates in string form and another source that uses date objects. To use the information, you must make the kinds of data match. Data sources might also structure the data differently. One source might have the last and first name in a single field; another source might use individual ...

Get Algorithms For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.