37

"C Vectors, Python Lists and Java Arrays are all the same things!" - my IT professor.

He's really talented... :D Don't you guys think? And the fun part is that these "gems" are quite common lately...

I hope I'll graduate soon ;_;

Comments
  • 3
    I hope you guys noticed the sarcasm. <3
  • 2
    Huh? the same he means, able to reference a collection of otger objects? because this the only way they are similar.
  • 2
    @samblaise Main difference is that arrays have a fixed dimension, lists do not.

    @magicMirror Nope, I wish he really did it mean that way... he believes that they are implemented and work in the exact same way, which is quite inaccurate even though the fundamental principle of those structures is very similar.
  • 2
    There is nothing similar between those three. Any two have similarities, but all three? nope.
  • 1
    C vector? Is that a thing ?
  • 1
    @ravik yes. he meant c++ vectors.
  • 2
    @magicMirror then he is precise and correct. These are the same thing in different languages.
  • 0
    @TheItalianGuy It's sad that you mock someone by exposing you own lack of knowledge. If you don't know how these are the same, you can simply ask.
  • 0
    (I assume he was talking about c++ vector and Java's ArrayLists)
  • 2
    @elazar You know what they say about assumptions...
  • 0
    I think I know: one should not assume that other people are stupid. Forgetting to add a single word is more likely.
  • 1
    @elazar I am sorry for the misunderstanding. He was saying that all three things are EXACTLY the same under all aspects, which is not true.
  • 0
    @TheItalianGuy was he talking about vector and ArrayList? If so, they are as similar as one can expect from different languages, and considering C++'s value semantics and templates - otherwise comparison is almost meaningless to begin with.

    In other words, the answer to "what is the equivalent of Python list in Java" is ArrayList, etc.
  • 2
    @elazar Since Python is the language they teach us in school, he was comparing Python's lists to Java arrays and C++'s Vectors, by saying they all have the same exact characteristics.
    I do agree there are some similarities between the structures you mentioned, but saying they are the exact same of python lists is pretty unprecise.
  • 8
    @TheItalianGuy they have the same runtime characteristics, up to minor differences. Same asymptotic complexity and similar memory locality.

    They are all implementations of the data structure known as dynamic array (or growable array). The underlying implementation and the basic interface is as similar as one can expect. Of course, there are differences because different people implemented them in different environments, but this is obvious.
  • 3
    @elazar Thanks for sharing that!
  • 2
    @TheItalianGuy you're welcome. Thanks for pleasant discussion.
Add Comment