Posts tagged with data structures

Join thousands of developers

Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.

No spam. Unsubscribe anytime. You can also follow me on X.

What is a binary tree and why would I ever want to reverse it

frederickvanbrabant.com

Senior CEO Frederick Vanbrabant helps you to answer this horrible interview question.

You have probably already heard the horror stories of code interviews where they ask you to reverse a binary tree on a whiteboard. (if not check this blog post that I profoundly disagree with). Well, a few days ago I was in that exact situation. And I had no idea what the interviewer was talking about. So what are these binary trees and why is it so critical that you know how to inverse them? Let’s find out.

Read more [frederickvanbrabant.com]

Benchmarks on sorting and serializing associative arrays vs classes in PHP

steemit.com

Larry Garfield, director of developer experience at Platform.sh, published some interesting numbers on arrays vs classes.

The first thing we can conclude is that if the one and only thing you care about is serialization/deserialization performance, associative arrays still win. They're the most time efficient by more than 50%, and the most space efficient by up to 20%. The second thing we can conclude is that stdClass should be used basically never. It's slower and more memory intensive than arrays in every circumstance. Just don't go there.

Read more [steemit.com]