• Post Reply Bookmark Topic Watch Topic
  • New Topic

How important are Data Structures (linked lists, trees, etc.)?  RSS feed

 
Sina Meraji
Greenhorn
Posts: 13
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a first year (second semester) artificial intelligence bachelor student and this semester we've been learning data structures (java).
Maybe it's the way we've learned them that makes me ask this question. The way we learned data structures was basically a presentation of the respective classes and how to initialize them (and in the case of stacks and queue and linked lists, a visualization of them, too).
I never got to see why they mattered. I'm not a lazy person, I'm interested in learning and practicing new stuff. In this case though I just don't have the motivation to even try using linked list, stack, queue and trees.

I can imagine that might be because I haven't written enough programs (therefore I haven't faced certain challenges where I could feel the necessity of those data structures). So I'm bringing my question here to sync my standards and get a definition of good and bad.
(Right now I mainly use ArrayList and it's more than enough for the problems I face.)

P.S: about everyone else who asked this question on Stackoverflow got thrashed by angry professionals who didn't actually answer the question please do answer the question even if it sounds annoying to you :p

Thanks
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From your description, I doubt that you are taking a data-structures course. It is probably just a beginners Java course.

A University data-structures and algorithms course generally implements the data structures (and not just how to use them)... in other words, you get to write your own version of lists, trees, etc.

Henry
 
Sina Meraji
Greenhorn
Posts: 13
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:From your description, I doubt that you are taking a data-structures course. It is probably just a beginners Java course.

A University data-structures and algorithms course generally implements the data structures (and not just how to use them)... in other words, you get to write your own version of lists, trees, etc.

Henry


Yes Henry we got to write our own versions of them, and to create their methods etc. But still, I'm failing to see the advantage..
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sina Meraji wrote:
Yes Henry we got to write our own versions of them, and to create their methods etc. But still, I'm failing to see the advantage..


It has to do with learning. Why do medical students do the simple stuff, when they have nurses to do it for them when they become doctors? Why do pharma students need to understand the drug interactions, when they will have automatic systems that will red flag it for them? And heck, why do baby tigers still pretend to hunt weaken animals that their parents have taken down for them, before eating?

And for developers, why do you have to learn (and code) well researched stuff, when they have already been coded (and optimized)? Well, how will you be able to do the complex stuff? Stuff that haven't been invented yet? ... when you don't have the practice?

Henry
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an excellent question, and deserves a detailed answer.

Firstly, I would not equate basic data structures like arrays and linked lists, with more complex data structures like queues
and graphs whose characteristics are not just the relationships within their data but also the operations they define on that data.
These complex data structures are fundamental to many AI algorithms:

  • A large number of AI problems reduce to tree and graph search problems where the nodes are different states and the AI should
    calculate the "best" path from current state to a particular state.
    Most of the well known graph algorithms for best first search - like A* or Djikstra's - use both graphs and priority queues
    as their fundamental data structures.


  • In supervised machine learning, regression and classification of inputs are common tasks. Algorithms like artificial neural networks,
    decision trees classifiers, boosted tree classifiers, and random forest classifiers all use weighted graphs as their
    fundamental data structures.

    ML itself is a cross cutting field that has applications in different areas like computer vision, linguistic interpretation, audio, signal and speech processing.
    So any data structure that is used by an ML algorithm is also getting indirectly used in the area where that algorithm itself is being used.


  • In natural language processing, parse trees are a fundamental concept.


  • In speech recognition, markov chains are modelled as weighted graphs.


  • Can you model all data as arrays and all algorithms to use only arrays? Sure. But often it involves some kind of unacceptable space vs time trade offs.
    That's the reason alternative structures like linked lists are used.

    What you should take away from this semester class is the intuition to calculate and understand things like algorithmic complexity and space time trade offs.
    That knowledge is golden and something which will come up often especially in an algorithm intensive field like yours.

    If you want to build an appreciation and motivation for data structures and algorithms, my suggestion is to explore and implement algorithms like the above from scratch.
    The main reason most software engineers can't appreciate their importance is because we tend to use libraries where all the data structure and algorithm thinking has already been done by somebody else.
    Strive to be one of those thinkers, not just one of the users.
     
    Sina Meraji
    Greenhorn
    Posts: 13
    Java Mac OS X Netbeans IDE
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Karthik Shiraly wrote:This is an excellent question, and deserves a detailed answer.

    Firstly, I would not equate basic data structures like arrays and linked lists, with more complex data structures like queues
    and graphs whose characteristics are not just the relationships within their data but also the operations they define on that data.
    These complex data structures are fundamental to many AI algorithms:

  • A large number of AI problems reduce to tree and graph search problems where the nodes are different states and the AI should
    calculate the "best" path from current state to a particular state.
    Most of the well known graph algorithms for best first search - like A* or Djikstra's - use both graphs and priority queues
    as their fundamental data structures.


  • In supervised machine learning, regression and classification of inputs are common tasks. Algorithms like artificial neural networks,
    decision trees classifiers, boosted tree classifiers, and random forest classifiers all use weighted graphs as their
    fundamental data structures.

    ML itself is a cross cutting field that has applications in different areas like computer vision, linguistic interpretation, audio, signal and speech processing.
    So any data structure that is used by an ML algorithm is also getting indirectly used in the area where that algorithm itself is being used.


  • In natural language processing, parse trees are a fundamental concept.


  • In speech recognition, markov chains are modelled as weighted graphs.


  • Can you model all data as arrays and all algorithms to use only arrays? Sure. But often it involves some kind of unacceptable space vs time trade offs.
    That's the reason alternative structures like linked lists are used.

    What you should take away from this semester class is the intuition to calculate and understand things like algorithmic complexity and space time trade offs.
    That knowledge is golden and something which will come up often especially in an algorithm intensive field like yours.

    If you want to build an appreciation and motivation for data structures and algorithms, my suggestion is to explore and implement algorithms like the above from scratch.
    The main reason most software engineers can't appreciate their importance is because we tend to use libraries where all the data structure and algorithm thinking has already been done by somebody else.
    Strive to be one of those thinkers, not just one of the users.


    This is awesome! thank you! The vision and intuition was exactly what I was looking for. Thanks again
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!