N
N
NoMoneyException2016-09-28 03:04:30
Programming
NoMoneyException, 2016-09-28 03:04:30

What does sequential memory mean?

came across this statement

In addition, both the stack and the queue use one sequential memory area.

As far as I understand, this is meant in contrast to lists. But if I implement a stack via a list, wouldn't that contradict what was said? Explain, please.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2016-09-28
@eugene_leshchinskiy

One consecutive piece of memory - this means "successive memory addresses". These will be a simple and dynamic array, a traditional device string, and all the memory structures that are based on them. Including the simplest stack and ring queue.
What is it for?
1. It's closer to the hardware: the code is simpler, the cache works better, which means it's faster.
2. Some functions, especially non-template ones, require sequential memory cells for their work.
Quite right, it will. Hence the famous "stack overflow" error - it is not clear how to set up a call stack of infinite capacity and a relatively simple device. Therefore, if very deep recursion is needed (for example, when bypassing networks), the call stack has to be emulated.

O
Oleg Tsilyurik, 2016-09-28
@Olej

came across this statement

The interpretation of such statements can vary greatly depending on the programming language used.
If you stumbled upon this in the general discussions in the book "Programming for Housewives", then do not take it to heart - the author himself does not understand what he is writing about.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question