Implementing Datastructure vs. using the Library datastructures
Anonymous User
182

I'm not fully sure if I used the right terms, but in terms of space-complexity and run-time, and pros vs cons,
can someone explain to me what the difference is implementing a data structure, vs. just using the library datastructure?

I'm pretty new to studying run-time and space-complexity, and for some reason, using something "prebuilt" like

LinkedList test = new LinkedList();

seems a little scary to me since it's so simple. Like as if there's a lot of heavy cons to it.
I took a C-Programming class and implementing data structures seems to be clear and black-and-white as to what I'm incorporating into my Datastructure, but using a library of a datastructures seems like a grey area that I wouldn't want to touch.

Now obviously I know I'm wrong because seeing these coding solutions they constantly use these library datastructures, so if someone has time, can they help clear up my confusion?

(Also on the sidenote, is there such thing as a "run-time" for initializing a data structure? Like if I were to implement my own LinkedList, I'd have to create a struct, call this and that, etc. So if I were to just simply create a new LinkedList like the line above, would it have a run-time of itself? And what would be the space-complexity of me just calling it?)

Comments (1)