The EOP for schoolchildren. - page 15

 
Алексей Тарабанов:

Guys, I'm a retrograde, but there is a stack (when the first stored value is retrieved last) and a queue (when first in, first out).

What's a pile?

When you delete an object on the stack, the FILO (first in, last out) rule is executed automatically.
When deleting objects on the heap, this rule is controlled by the programmer.
A heap is a queue with a priority. It turns out that the heap is a queue.

 
Roman:

When deleting an object on the stack, the FILO (first in, second out) rule is executed automatically.
When removing objects on the heap, this rule is controlled by the programmer.
The heap is a queue with priority. It turns out that the heap is a queue.

the evening stops being languid : any more versions ? :-)

 
Roman:

When deleting an object on the stack, the FILO (first in, second out) rule is executed automatically.
When deleting objects on the heap, this rule is controlled by the programmer.
The heap is a queue with priority. It turns out that the heap is a queue.

This is tricky.

 
Алексей Тарабанов:

Guys, I'm a retrograde, but there is a stack (when the first stored value is retrieved last) and a queue (when first in, first out).

What's a pile?

A heap of these...

One variant is dynamic object creation via new, the second variant is automatic object creation (without new).

 
Maxim Kuznetsov:

the evening stops being languid : any more versions ? :-)

In general, a binary heap is a data structure of an abstract tree type.
This type is called a priority queue.

 
Алексей Тарабанов:

Wise.

A pile is just a pile. You can think of it as all the memory you haven't occupied yet.
You can take pieces from it to suit your needs (you can place an object or an array of scalars or just like that).
And you can take/retrieve it in any order, that's what a heap is.

A schoolboy who declares that the order of allocation/release in the pile is important, let him kill himself ap the wall remains for the second year.

 
Roman:

In general, a binary heap is a data structure, in the form of a tree of an abstract type.
This type is called a priority queue.

I would lie down for six months.

 
Roman:

In general, a binary heap is a data structure in the form of a tree of an abstract type.
This type is called a priority queue.

how the heap is physically marked and organized, the application programmer should not hesitate at all.

PS/ and it is not a priority queue all of a sudden

 
Well done... In the topic for schoolchildren, you started discussing at a professional level. And for the sake of full understanding, the schoolboy was told: "Think for yourself. Whatever you want to do, do it yourself"... But I asked them to explain to me what to pay attention to when addressing the class. Which option might be given priority over the others.
 
Alexey Viktorov:
Well done... In the topic for schoolchildren, you started discussing at a professional level. And for the sake of full understanding, the schoolboy was told: "Think for yourself. Whatever you want to do, do it yourself"... But I asked them to explain to me what to pay attention to when addressing the class. Which option in which cases might take priority over others.

Can be like this: if you know exactly what you need one or two objects of the same class - you can use variables with the class type - so in kodobase the drummer does - he defines variables with the class type on global level, and accesses class methods via these variables. And if in the process of execution of the program you create objects via new, then you have no choice but to use pointers - the object is created "somewhere in memory", but you can't access it with a variable - you haven't defined it and there's nothing to access, but you have a pointer to this object - you defined it when creating a new object - so you access and manipulate it with this variable.