views:

875

answers:

16

So do I like really need to learn about them ? Isn't there an interesting way to learn about stacks, linked lists, heaps ,etc ? I found it a boring subject.

**While posting this question it showed some warning.Am I not allowed to post such a question ? Admins please clarify and I will delete it :/

Warning :: The question you're asking appears subjective and is likely to be closed.

okay..I get it So what is THE best way to learn them ? What book do I refer ? What website ?

+3  A: 

Whether you like it or not, all programming is built around data structures. You may never have to write one, but you will have to choose which one to use many times. It is not really a requirement to programming in general, but if you want to excel in the field, understanding of the basics is a must.

Anyone can build a shed without knowledge of materials or construction techniques. You can even work in a house placing bricks and mortar under the orders of someone else, but if you want to build a house yourself, you do need to understand materials and techniques.

Data structures are the programming materials. Algorithms are techniques. Will you use data structures? You will use the simplest ones in a daily basis, each so often you will need to solve a problem where an specific data structure is required, and while you may manage not to build your own bricks, you will need to understand whether you need bricks or a concrete wall for your purposes.

David Rodríguez - dribeas
I see. I am not able to realize their importance being a beginner. I am like why use them at all ? May be I ll research a bit more. Thanks.
Serenity
Well, the alternative to learning about data structures is actually having to create your own implementations whenever you will face a more complex task than calculating 2+2. Which means kind of reinventing not even the wheel, but the cart all the way up to steam engine while the rest of programmers have driving licences and use pre-made cars.
Gnudiff
+47  A: 

It's compulsory to learn about data structures if you want to be a programmer. Data structures are your bread-and-butter - if you don't understand things like the behavior, uses, and run-time complexity ('big-O') of at least the basic structures (arrays, linked lists, stacks, queues, trees (binary / n-ary, self-balancing varietes), hash-tables, heaps, graphs) and the algorithms that run on them (insert / locate / delete), you won't know which is appropriate to use under what circumstances.

Every trade has its tools; these are ours. Data structures are the most basic underpinnings of almost any algorithm that you're going to learn. Unless you want to be a cargo cult programmer, you need to understand how they work.

Whether or not there are interesting ways to learn about them is a separate question entirely... :)

tzaman
+6  A: 

As you get more experience you will find that algorithms and datastructures are invaluable to your day-to-day development, and actually pretty interesting.

By learning about them now you will learn:

  • Which data structure is appropriate for which context, i.e. when to use a single-linked list, when to use a stack, when to use a queue, when to use a tree
  • Which algorithms are appropriate for which purpose, such as tree depth-first search or breadth-first search.
  • Space and time complexity of algorithms, for example why is a quicksort sometimes the best solution, and sometimes heapsort.
  • Overall it'll teach you the beginnings and fundamentals of computer science, even if you never have to implement a stack again you'll know the kind of thought and consideration that goes into it. If you then ever have to implement your OWN data structure (and chances are you will, quite often), you will know what to do and what not to do.
MadKeithV
In my (not very weighty) opinion and experience, you don't learn about data structures until you get them wrong. You may have the information available, and it is necessary to have an idea of what data structures are possible, but to know how and when to use them I needed to get them wrong, and correct it.
penguat
I had algorithms and data structures as one of the first classes in my CS education, and I liked it a lot - so I personally learned about them in an academic context.However, you don't truly appreciate the value of the knowledge "in the field" until the first time it *really* matters, which is usually when you get it very wrong indeed :)
MadKeithV
A: 

No body should force you to learn anything you don't want to learn.

If you're the type of person that is compelled to be the best that he/she can be at what he/she does, and you love what you do for a living, you'll learn everything there is to know on your own accord.


@happysoul: You should ask yourself WHY learning data structures bore you. Also, it would help if you also identify what DOESN'T bore you.

If you at least love to learn about algorithms, I'm sure we can all suggest a perfect marriage of the two that would be exciting to learn!

My recommendation for best algorithm/data structure combo for the most fun learning experience: graphs.

polygenelubricants
+8  A: 

I would go even so far as to say that most of programming revolves around manipulating data structures, it is the foundation of computing after all: you get some data, you process it, you possibly give output. All the data usually reside in data structures and choosing inappropriate structures will have the bigger impact the bigger the project.

Gnudiff
+2  A: 

Is it compulsory to learn about arithmetic to be an engineer?

Crashworks
+5  A: 

If you want to be a successful programmer, data structure is a must. How will you program if you don't know data structures and algorithms?

fastcodejava
+1  A: 

It should be, yes...

peSHIr
+1  A: 

Yes 99% of books on Data Structures are boring and exercises contrived. They feel like they are just making up problems that server no practical purpose :( This book is the one exception to the rule I've come across. You will have a naive but working RPG game by the end of the book: Data Structures for Game Programmers

Read the above book and you will solve your chicken and egg problem and see you really can't do much without data structures after all.

daveangel
+1  A: 

Well, this may sound a little awkward but I wouldn't say it is COMPULSORY to learn Data Structures to be a - regular- developer. Seriously! Of courser if you study then hard it will give you a lot of insights and knowledge on several programming aspects and that's always good. But compulsory ... well, I think it is just too much. VERY GOOD would be enough.

Let me explain why. It is not that often, for today, to write Data Structures code because - let's face it - it would be RE-writing, RE-inventing what we already know for so many years! What I would say it is COMPULSORY is to study just the general theory of them and the APIs/libraries that are already commonly in use (and tested and optimized) like the Collections API in Java. You must know by heart the differences between a List and a Set (in Java for instance) and their capabilities and proper usage but you don't need to know exactly HOW they are implemented - checking every private method and attribute - to deal with most common, day to day, coding problems. You will do just fine without all the "guts" of Data Structures for the general stuff. We face different challenges now.

But don't get me wrong - neither think I am crazy or naive! Off course there are situations that you will need to implement yourself some sort of custom data structure (maybe your own BalancedBinaryTreeMap!). You got to be prepared for everything.

I am just arguing about being compulsory or not. Again, I don't think is compulsory but it is indeed very good. Cheers.

Bill_BsB
At some point, you will need to create a data structure that goes beyond the basic ones that were invented 50+ years ago. If you don't know the basics, you will fail. Period. It is compulsory in the sense that if you want the skills and knowledge to program for any problem you WILL need them.
San Jacinto
@San Jacinto Agreed. Or you will need to implement a variation of an existing data structure optimized for your particular situation. The implementations in language libraries are designed to be good enough for most uses, most of the time. There are always situations where no existing data structure meets your requirements.
KeithB
In a way your "You must know by heart the differences between [two or more specific collection implementations in the framework you use] and their capabilities and proper usage" implies that in fact your answer equates to "Yes, it is compulsory". Wouldn't you agree?
peSHIr
+3  A: 

If you want some evidence for the importance of data structures, take a look at the Google hiring process. Whatever you think about Google as a company, there is no denying that they have some very good people working for them. Their interview process is setup to determine the candidates knowledge of data structures and algorithms. Because when it comes down to it, that is what is at the core of programming, no matter what language you are working in or what domain you are programming for.

If you are planning a career as a professional programmer, you need to know the fundamentals, not just how to crank out code that "works". Otherwise, your just playing.

KeithB
+1  A: 

I suppose you could learn programming without learning a whole lot about data structures or algorithms. To make an equivalent example, think of it like if a carpenter knew how to build things, but didn't know about measurements and such. Would he be able to get a career in carpentry? Possibly, but let's say he needed to know the exact material he would need to complete a project. He'd probably get fired because he doesn't know what sort of material or measurements to use.

So with data structures and algorithms, you can say it's the ability to give exact measurements of an application and knowing what sort of performance you'll get out it.

Daniel
+1  A: 

Like a musician learning scales, data structures are part of the tools of the software trade. Sure you can work as a programmer without the knowledge but you're handicapping yourself. If I'm interviewing two people for a position and one of them understands and uses structures and the other can't even explain what a stack is, my choice is pretty clear.

If you want to be judged to be a competent, employable programmer, you need to learn your craft.

Larry
+1  A: 

If you take the attitude of "is it compulsory" with regards to any of the building blocks of programming languages, you're probably not cut out to be a coder. Regardless of "compulsory" or not, you should always be looking for new concepts to learn and seeing if it'll improve your coding style/standard.

But in answer to your question: yes.

Computer Guru
+1  A: 

Is it compulsory to learn them?

No, you can program without them, just as it's not compulsory to break your code into functions.

That being said, if you want to be an effective programmer that can write at least decent code without getting your car egged by your coworkers, you want to at least be able to make a decent selection of library classes.

Every programmer should understand the tradeoff between a LinkedList and an Array, or why binary searches and binary trees are useful for sorted data. This isn't just about performance - it's about correctness too since you can't just put anything into a tree set.

Does it mean that you need to know how to implement your own AVL tree, build super-smart data structures, etc.? Not necessarily. It's a matter of how much you want to know what's going on "beneath the hood" and whether your tasks necessitate it.

I'm not a big fan of deep data structure and algorithms questions in interviews because the vast majority of developers don't need to implement these things, just to use library stuff. I prefer to ask job related questions in interviews. However, accept that if you don't learn those things you would face a tougher battle to get other jobs.

Uri
+2  A: 

I'd say it's compulsory at some point in your development to have a firm grasp. I'm not necessarily sure the standard Data Structures course is the best way to learn. Sometimes, the best way to learn them is "I have problem X. For some reason, it's taking my algorithm a long time to solve X. How can I make this faster?"

One book I'd highly recommend is Programming Pearls. It has some really good analyses, backed by a lot of examples of where the real-world motivations for the solutions came from. It presents the problems in an interesting manner, and never teaches by giving you a laundry list of data structures.

Jimmy