Home > Net >  The stack is what mean? There are several kinds of stack?
The stack is what mean? There are several kinds of stack?

Time:11-04

Recent understanding of the stack, found two ideas from the Internet, make me a little meng,
Said the first stack is a collection of objects, object called Stack , to add data to follow, advanced the principle, after this I understand, is a collection, can traverse,
But then see another way of saying that the stack is a memory, memory stack and memory storage of different things, heap memory CRL will regularly cleaned and assurance procedures fluency,
So I want to ask a few questions
1, there are several kinds of stack,
2. What is the meaning of each stack,
3. Stack When this collection what use?
100 points, for bosses to reassure

CodePudding user response:

Heap and stack are two different concepts, not a few

Heap is a compiler release distribution, generally used as the underlying runtime runtime variable storage and distribution, the stack is program ape their allocation and release,
Commonly used as storage local variables and return values as well as the function's address, etc.,
Heap is such as storage mode, storage of linear list, stack mode is advanced after the

CodePudding user response:

1. Upstairs, stack concept has two, one is the data structure, data structure and application code, another concept is memory layout of all the programs run

2. As 1 say

3. In c # is the Stack of the corresponding data structures define, describe an element after the advanced class

Basically you can meet a container class or collection of most classes, are List is given priority to, and the Stack is belong to the class of specific purposes, so what is a collection class or container classes? Is that the class can contain a lot of other objects, can be understood as similar to an array of things

What time back to the question, can use the Stack that collection? First ` Stack ` is a generic form, represents a string of Stack collection, collection and used in the need to enter the string out
the condition of the
If there is an example of this is I made a report software, this software is used to students, demand function is the slower the release the priority over reports of student

The use of time if you have A B C three students in turn, how at the time of processing according to the C B A handle? One way is to use the Stack to store

- put A Stack of

- B to be included in the Stack

- C to be included in the Stack

In accordance with the characteristics of the Stack, first take out after entering, so A first enter, so A the slowest, and finally into C, so the latest, so take out the order will be the order of C, A, B

Maybe you will think that this method is not special enough, because my last started from an array can also, right, just I let demand complex can reflect the advantage of the Stack, such as in the process of I handle students reported, and constantly have students come here, this is interesting

- put A Stack of

- B to be included in the Stack

- C to be included in the Stack

- according to the characteristics of the Stack, the C students, removed from a Stack into the report

- D at this time to come over, put D in

- according to the characteristics of the Stack, the students take the slowest enter, removed from the Stack D student

If the above requirements, don't use the Stack you can think about how to write a simple

CodePudding user response:

Don't copy can check the information on the net, mainly is the logic of chaos, clarify the network

1. The word "stack" has different meaning in the field of hardware and software,
(1) in the field of hardware, the stack is about term memory allocation, heap memory (heap) is the floorboard of the stack (stack) with memory, stack and heap is a piece of memory has some characteristics of area,
(2) in the field of software, heap heap and stack (stack) are two different types of abstract data structure, it is important to note that in Chinese context, the stack is often translated as "stack" or "stack", in the Chinese context, stack in data structure, the stack==,

2. To clear up the things above, you can check information,

3. System. Collections. Generic. Stack Mainly used for temporary storage when you want to data, which means you get to an element after don't need it, can be directly deleted, at the same time you also need to adopt the lifo logic, so this time you can consider to use Stack .

CodePudding user response:

Heap is a continuous random access memory block, the stack is advanced after the block of memory,

CodePudding user response:

Two statements are true,
Like objects can be your boyfriend/girlfriend, can also is a data storage unit in c #,

CodePudding user response:

The stack is:
[align=right] stack is a kind of "last in, first out" execution algorithm data structure,

Imagine a little diameter, the open end of the bamboo tube closed at one end, there are a number of writing has a number of small ball, the diameter of the ball slightly smaller than the diameter of the bamboo tube, now put the different number of balls on the bamboo tube inside, can discover a pattern: put it in the first ball can only take out after, on the other hand, the ball can take out first, after put in so after the "advanced" is the characteristics of this structure,

Stack is a data structure that is opening up a storage area in the memory, data one by one sequentially deposited (also known as "pumped - push") in this region, has an address pointer always points to the last into the stack data in the data unit, store the address pointer register is called a stack pointer, began in the unit of data is called "the bottom of the stack," data one by one, this process is called "stack", in the process of the pressure of the stack, and each has a data onto the stack, in behind and before a unit connected to a unit, the stack pointer address automatically add 1, read the data, in accordance with the read data in the stack pointer address, the number of addresses in a stack pointer automatic minus 1, this process is called "pop pop," such as the fulfillment of the principle of the lifo,

Stack is one of the most commonly used in computer data structures, such as a function call in a computer is to use the stack,
Can use an array to store the stack, also can use will introduce the list of storage, [/align]

CodePudding user response:

Heap and stack are the two concepts,

Data structure of the book, the upstairs also speak well, I don't think I speak good upstairs, just let it be, ha ha ha ha ha

CodePudding user response:

https://www.cnblogs.com/shineblog/archive/2012/04/18/2455171.html

CodePudding user response:

refer to the second floor lindexi_gd response:
1. Upstairs, stack concept has two, one is the data structure, data structure and application code, another concept is memory layout of all the programs run

2. As 1 say

3. In c # is the Stack of the corresponding data structures define, describe an element after the advanced class

Basically you can meet a container class or collection of most classes, are List is given priority to, and the Stack is belong to the class of specific purposes, so what is a collection class or container classes? Is that the class can contain a lot of other objects, can be understood as similar to an array of things

What time back to the question, can use the Stack that collection? First ` Stack ` is a generic form, represents a string of Stack collection, collection and used in the need to enter the string out
the condition of the
If there is an example of this is I made a report software, this software is used to students, demand function is the slower the release the priority over reports of student

The use of time if you have A B C three students in turn, how at the time of processing according to the C B A handle? One way is to use the Stack to store

- put A Stack of

- B to be included in the Stack

- C to be included in the Stack

In accordance with the characteristics of the Stack, first take out after entering, so A first enter, so A the slowest, and finally into C, so the latest, so take out the order will be the order of C, A, B

Maybe you will think that this method is not special enough, because my last started from an array can also, right, just I let demand complex can reflect the advantage of the Stack, such as in the process of I handle students reported, and constantly have students come here, this is interesting

- put A Stack of

- B to be included in the Stack

- C to be included in the Stack

- according to the characteristics of the Stack, the C students, removed from a Stack into the report

- D at this time to come over, put D in

- according to the characteristics of the Stack, the students take the slowest enter, removed from the Stack D student

If the above requirements, don't use the Stack you can think about how to write a simple


Excuse me, what you have said "upstairs" refers to the first floor tangyanzhi1111 reply
  •  Tags:  
  • C#
  • Related