

Ask YC: Data structure or Algorithm selection for a problem? - yearsinrock

data structure or algorithm which one is more important in solving a problem<p>and how selection of both is important in solving a problem
======
cperciva
To quote Hofstadter: Mu.

Particular algorithms operate on particular data structures; a binary search
on a sorted list makes sense, while a binary search on an unsorted list is
meaningless. It doesn't make any sense to have one of "a good algorithm" or "a
good data structure" without the other.

~~~
yearsinrock
I think this reply perfectly answers my question.

------
boucher
Good introductory text: Cormen/Leiserson/Rivest/Stein: Introduction to
Algorithms (2nd edition)

[http://www.amazon.com/Introduction-Algorithms-Thomas-H-
Corme...](http://www.amazon.com/Introduction-Algorithms-Thomas-H-
Cormen/dp/0262032937/ref=pd_bbs_2?ie=UTF8&s=books&qid=1198139015&sr=1-2)

Good advanced text: Jon Kleinberg/Eva Tardos: Algorithm Design

[http://www.amazon.com/Algorithm-Design-Jon-
Kleinberg/dp/0321...](http://www.amazon.com/Algorithm-Design-Jon-
Kleinberg/dp/0321295358/ref=pd_bbs_2?ie=UTF8&s=books&qid=1198138989&sr=8-2)

------
bayareaguy
I suggest you read "Algorithms + Data Structures = Programs" by Niklaus Wirth.
<http://tinyurl.com/yw7tgo>

------
aristus
Mooooo..... :)

I usually visualize the data structure that exists, or that I want, and work
"backwards" from there. But whichever direction you use, always always
remember that the idea is to make the design simpler and more clear.

~~~
boucher
Well, no, not always, always.

Use the data structure that makes the design more efficient. Clarity might be
nice, but an O(n) solution is not acceptable when a reasonable O(log n) or
O(1) solution exists.

------
z0ltanz0ltan
At all the above maniacs ... I think what yearsinrock meant was "Data
Structure and Algorithm" selection for a specific problem...

~~~
cperciva
That was my first thought based on the thread title, but it doesn't quite fit
with the text "data structure or algorithm which one is more important in
solving a problem" which follows.

------
flashgordon
I didnt think that choice was orthogonal?

