今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
How to choose a data structure
- [Instructor] Now, there are loads of different kinds of data structures. In fact, there are probably more than you'll ever use in your whole career. So how do you decide which one to use? The answer depends on your use case. There are a few things to consider when you're deciding which ones to go for. The first thing to think about is do you know in advance how many items are going to be in the data structure? There might only ever be 10 things in there, or you might have no idea how many items are going to end up inside this thing. Another thing to think about is whether you want to allow duplicates. Sometimes you might not care if your data structure contains several of the same thing, but to other times you might want to enforce that no duplicates are allowed and everything in it has to be unique. Next up is the order of elements. Is it important that the data stays in a specific order? For example, imagine a…