algorithm - Copy a string in constant time? -


I have seen the work of copying the string as O (n), where n is the string length, because It has been assumed that we should walk again through each character of the string and have to copy it individually. However, is it not possible to prepare instructions for a compiler who can copy an entire block of memory in an ongoing time? What is the potential of today's common architecture?

As far as I do not know.

However, for O () notation to be meaningful, you must first define the cost of each original operation. It is often left because "it is clear" and most of the time it is actually a good example of your (fictional) scenario where it is mandatory to define the cost.

Second, a slightly more useful example is in the analysis of disk or tape storage search / sort algorithms.

Comments