views:

98

answers:

4

Suppose i have a software program which uses an inefficient data structure. Now how can i make it efficient. it seems that we should simply change the data structure but its not the case in reality. according to my point of view the whole software needs to be changed. what is your point of view?

+1  A: 

This is very subjective and should probably marked be as such.

It would widely depend on which language you use, how big of a part this data structure plays in the application, how flexible the original code was written to allow for structure changes, and the actual type of the data structure.

In the most part, If your application was written correctly, you should easily be able to change, but you do find instances where the design would not allow for easy change, and a harder solution is the only at hand.

astander
+2  A: 

The question might be a bit too vague for us to give a precise answer, but using an "inefficient" data structure can mean :

  • it'll take more time / more CPU to access data (be it for insertions/reads/deletions)
    • which might lead to performance problems ; i.e. a slow application
    • and time is money
  • it might take more time to write code that access that data structure
    • and developer's time costs money too


Should the whole application be changed, or should it be corrected to use the "right" data structure ?

Well :

  • How much would it cost to change data structure ?
  • And how much would it cost to change the whole application ?
    • Including the time required to migrate data, explain users how to use the new application, ...
Pascal MARTIN
A: 

You need at least to know what will be cheap and what expensive with good algorithms. When Java was just out I saw somebody produce a Collections framework. They didn't know much about data-structures, and it was very inefficient. I mailed them and they said "Oh - I knew about that. Now that I have attracted people's interest to this problem, somebody else can make it work fast." But they had chosen operations for which there were no good (log n) implementation, and they hadn't provided operations which can be implemented efficiently and which would have been useful in that environment (I think I remember merging priority queues).

So there was no good way to take a program written with their unfortunate Collections framework and speed it up just by fixing the implementation of the framework.

mcdowella
A: 

I'm not sure this question has been asked in such a way to be answered properly. It's way to vague. IMHO

Jonathan