Check out a free preview of the full Introduction to Data Structures for Interviews course:
The "Other Considerations" Lesson is part of the full, Introduction to Data Structures for Interviews course featured in this preview video. Here's what you'd learn in this lesson:

Bianca reviews other aspects to think about when implementing a data structure, including side effects, and optimization vs. readability, and how to ask for more information from an interviewer.

Get Unlimited Access Now

Transcript from the "Other Considerations" Lesson

[00:00:00]
>> Bianca Gandolfo: Okay, more things to consider, and then I'm done. So if you're doing something in place, you are essentially creating side effects, so whenever you do that you want to discuss that with your interviewer. So, for example, the reason side effects are bad is because if you are mutating your data structure.

[00:00:24] We're talking a lot about having things by reference, so if you change this data structure it can have unintended consequences in other places on your code that are also relying on this data. So whenever you do an in-place algorithm, you're essentially doing side effects. So you're saving space.

[00:00:42] But there is a trade-off and so just being aware that and whether or not you should preserve the original order. Set versus map versus object. We talked about that, so like different lengths. All your off-by-one errors. Optimizing versus readability. What's better? If you're gonna take it to the next step, if you're gonna use bit shifting is that truly optimizing?

[00:01:08] Or are you sacrificing readability for the person who comes up after you who's not aware, who's not very familiar with bit wise kind of operators? Also, just always think about what more information can you ask your interviewer? Because often you can basically figure out exactly what the, so, if you ask enough questions.

[00:01:36] It's not like they're gonna give you the answer, but based on the constraints they give you, like time complexity constraints, space complexity constraints, and you know your data structures, you can kinda whittle down what kind of problem it is. So just keep thinking about, okay, what are the more, what's more information than I could ask for?