Chapter 6

Structuring Data

IN THIS CHAPTER

Bullet Defining why data requires structure

Bullet Working with stacks, queues, lists, and dictionaries

Bullet Using trees to organize data

Bullet Using graphs to represent data with relations

Raw data is just that: raw. It’s not structured or cleaned in any way. 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). The first part of this chapter discusses the need for turning raw data into structured data.

Python provides access to a number of organizational structures for data. The book uses these structures, especially stacks, queues, and dictionaries, for many of the examples. Each data structure provides a different means of working with the data and a different set of tools for performing tasks such as sorting the data into a particular order. This chapter presents you with the most common organizational methods, including both trees and graphs (both of which are so important that they appear in their own sections).

You don’t have to type the source ...

Get Algorithms For Dummies, 2nd Edition 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.