Day 38 was about JavaScript data structures. Which we kind of just went into freecodecamp courses without a bigger picture being explained. It just went right into writing arrays.

First question did explain that arrays held collection data, but I like knowing the bigger picture of its importance.

So in my quest of truth of the bigger picture I read a blog post explaining data structures. In short different situations require different data structures. Different types of data structures trade off one property for another.

Stacks and Queues are array-like structures that differ only in how items are inserted and removed. Linked ListsTrees,and Graphs are structures with nodes that keep references to other nodes. Hash Tables depend on hash functions to save and locate data.

Linked lists are optimal for storage and can be made into stacks and queues (linear time). At the other, no other structure can match the search speed of hash tables (constant time). Tree structures lie somewhere in the middle (logarithmic time), and only a graph can portray nature’s most complex structure: the human brain (polynomial time). Knowing when to use which data structure is a key skill.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: