Reputation: 1431
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?
Upvotes: 1
Views: 416
Reputation: 19601
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.
Upvotes: 1
Reputation: 401012
The question might be a bit too vague for us to give a precise answer, but using an "inefficient" data structure can mean :
Should the whole application be changed, or should it be corrected to use the "right" data structure ?
Well :
Upvotes: 3
Reputation: 166396
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.
Upvotes: 1