I would like to know what it means when some one says that it is too expensive opearation.Like While chossing data structres over LinkList and Arraylist it is generally insertions at begining will be less expensive in arraylist as in LinkedList.
I know that they are talking about Memory consumption and milliseconds requires to do an opearions.I was wondering in todays world when RAM is avialable at such at cheap rates then why would any programmer would too much about the resources utilised.
Mobile devices don't always have tons of spare memory, so for apps running there, it can be a consideration.
And there are applications where millisecond delays can mean the difference between success and failure - a missile guidance system, or a nuclear reactor shutdown procedure. Yes, these are extreme examples and (thanksfully) somewhat rare, but they ARE real examples.
also...perhaps there is an operation that takes one millisecond to run, but it needs to be called a billion times...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Focusing on memory is too narrow a scope for the concept of "expensive". Expensive means consuming more resources than we would prefer. The resource in question could be memory, but often we are talking about the time necessary to complete the task. Sometimes we're referring to bandwidth. Our application may depend on a remote service; calling that service might be expensive because our bandwidth is limited, or it might be expensive because the request takes a long time to serve. A database call could be expensive if we have a lot of logic and joins in our SQL, or if we're doing locking and managing transactions. We have to consider server resources in addition to just what the application needs to run locally.
Beware of people who say that something is an "expensive operation" and expect that to end the conversation. Actually the next thing to ask is "Expensive compared to what?" It's all very well to say that it's "expensive" to get a row from a database, but if you don't have a cheaper alternative, and you need to get that data, then you're just going to have to pay up and get the data.
And if there are alternatives, then assigning them values on one particular metric (say, amount of memory used) and choosing the one with the smallest value (e.g. least amount of memory used) isn't always the best choice either. There may be another metric (say, amount of run-time required or difficulty for beginning programmers to understand the code) in which other alternatives may be a better choice. In this case you have to decide which of the competing metrics is more important in this particular case. And there is not necessarily a single answer to the question, either. Often you can change the assumptions, or the environment, or even the requirements to make the choice easier.