How to Choose an Effective Data Structure

The data structure you choose can have a huge effect on the complexity of the code you have to write. We saw this firsthand when we tried to update the age attribute of author. When you choose the wrong data structure, you end up fighting it in your code, but if you choose an effective data structure, it makes your code simpler and more concise. So how do you choose an effective data structure? It is a skill that you will develop over time, and you will learn through trial and error. An important first step is knowing that you are choosing a data structure and knowing what data structures you can choose from. On the first website I built, I used strings for nearly all my data structures because I didn’t ...

Get Learning to Program 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.