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

4 points by yearsinrock ↗ HN
data structure or algorithm which one is more important in solving a problem

and how selection of both is important in solving a problem

9 comments

[ 1.9 ms ] story [ 30.1 ms ] thread
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.

I think this reply perfectly answers my question.
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.

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.

I didnt think that choice was orthogonal?
At all the above maniacs ... I think what yearsinrock meant was "Data Structure and Algorithm" selection for a specific problem...
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.