Alex Rivera | Logout

what is the meaning of O(1), O(n), O(n*n) memory?

Asked 2011-11-22T14:51:25.327
33

Possible Duplicate:
Plain English explanation of Big O

Many times when time complexity of a algorithm is talked about, memory also comes into account. I want to know what is the meaning of big-O(1), big-O(n), big-O(n*n) memory?

And how it is related to time complexity?

Edit
Report

1 Answer

2

Complexity in terms of mamory mean how fast required memory size growth whilst growing a number of items to be processed. A good example is sorting algorithm.

  • O(1) and O(log n) mean that whilst sorting N items algorithm requires less memory then total memory allocated for N items. (AKA in-place sorting)
  • O(n) - memory consumption is linear so memory consumption growth as long as items count growth
  • O(n*n) mean that algorithm requires much more additional memory.
answered 2011-11-22T14:57:47.570

Your Answer