The question about the stack, what are the characteristics of the stack

Updated on educate 2024-02-09
7 answers
  1. Anonymous users2024-02-05

    Since B comes out of the stack first, the stack starts as follows. ba

    Then B is out of the stack, so before the out of the stack is as follows: DC

    A and then F out of the stack, so before out of the stack is as follows: fe

    A then comes out of the stack in turn, and the last order is b, d, c, f, e, a, so it should be at least 3

  2. Anonymous users2024-02-04

    In computer science, a stack is a linear table that restricts insertion or deletion only to the footer.

    A stack is a data structure that stores data according to the first-in, last-out principle, the data that enters first is pressed to the bottom of the stack, and the last data is at the top of the stack, and the data is ejected from the top of the stack when the data needs to be read (the last data is read out first).

    A stack is a special linear table that can only be inserted and deleted at one end. Stack items in buckets, pile them down first, and then pile them up one by one. When taking it away, you can only take it one by one from above. Heaping and fetching are carried out at the top, and the bottom is generally immobile.

    A stack is a data structure similar to a bucket stacking of items, and one end of the deletion and insertion is called the top of the stack, and the other pile is called the bottom of the stack. Inserting is generally referred to as pushing, and deletion is called popping. Stacks are also known as last-in, first-out tables (LIFO tables).

    1. Push algorithm.

    If it is top n, the overflow information is given, and the error is handled (check whether the stack is full before entering the stack, and overflow if it is full; If you are not satisfied, you will do it);

    set top=top+1 (stack pointer plus 1 to point to the stack address);

    s(top)=x, end (x is the element of the new stack);

    2. Offstack (POP) algorithm.

    If top 0, the overflow information will be given, and the error will be handled (check whether it is an empty stack before retreating, and overflow if it is empty; If it is not empty, it will be made );

    x=s(sop), (the element after the destack is assigned to x);

    top=top-1, end (stack pointer minus 1, pointing to the top of the stack).

  3. Anonymous users2024-02-03

    A stack is a data structure that executes a last-in, first-out algorithm.

    A stack is one such data structure. It creates a storage area in memory into which data is stored sequentially (i.e., "pushed") one by one. There is an address pointer that always points to the data unit where the last data pressed into the stack is located, and the register that holds this address pointer is called a stack indicator.

    The unit that starts to put the data into it is called the "bottom of the stack". The data is stored one by one, a process called "stacking". In the process of stacking, each time data is pressed into the stack, it is placed in the next cell connected to the previous unit, and the address in the stack indicator is automatically added by 1.

    When reading this data, the data is read by the address in the stack indicator, which automatically subtracts 1 from the number of addresses in the stack indicator. This process is called "pop-up pop". In this way, the principle of last-in-first-out is realized.

  4. Anonymous users2024-02-02

    The basic operations of the stack are as follows:1) Initialize a stack: initstack

    2) Destroy a stack: destroystack

    3) Clear a stack: clearstack

    4) Determine whether a stack is empty: stackisempty5) Return the number of elements in the stack, that is, the length of the stack: stacklength6) Enter the stack, add an element to the stack: push

    7) Out of the stack, kill the top element of the stack :pop

    8) Burn back to the top of the stack element, but not out of the stack: gettopFor the data structure of the stack, I will first write about its basic concept.

    One. Basic Concepts:

    A stack is a linear table that is limited to inserts and deletes at the bottom of the table.

    A stack is a linear table, except that the inserts and delete of the stack can only be at the end of the table.

    For ordinary linear tables, you can insert and delete operations anywhere in the table.

    lifo: last in first out.

    Top: The end at which inserts and deletes.

    Bottom

    In fact, in our computer science, there is more of a kind of residual thought, "the idea of the first and the last". In many algorithms or applications, we need to use "first-in, last-out thinking", and we can consider using stacks to achieve it.

    Two. Storage Structure:

  5. Anonymous users2024-02-01

    The meaning of the stack is 1A house for storing goods or for travelers to stay. 2.Bamboo and wooden fences for raising livestock.

    Extended Information: A stack, also known as a stack, is an operationally constrained, linear table. Limits linear tables that only insert and delete at the footer.

    This end is called the top of the stack, and conversely, the other end is called the bottom of the stack. Inserting a new element into a stack is also known as entering the stack, entering the stack or pressing the stack, which is to put the new element on top of the stack element to make it a new top element; Deleting an element from a stack, also known as stacking or unstacking, is the process of removing the top element of the stack so that its adjacent elements become the new top element rubber match.

    As a data structure, the stack is a special linear table that can only be inserted and deleted at one end. It stores data according to the principle of LIF, the data that enters first is pressed into the bottom of the stack, and the last data is at the top of the stack, and when the data needs to be read, the data starts to pop up from the top of the stack (the last data is read out by the first one). The stack has a memory function, and there is no need to change the pointer at the bottom of the stack during the insertion and deletion operations of the stack.

  6. Anonymous users2024-01-31

    To get a clear understanding, you have to study:

    1. Definition of stack;

    2. How the stack is used in memory;

  7. Anonymous users2024-01-30

    The stack is like queuing up to buy something, the first to buy first.

Related questions
6 answers2024-02-09

How to pretend to be a Libra?The following is to invite Libra friends to teach live.

7 answers2024-02-09

The 12 zodiac signs all have their own exclusive labels, they are all different, and they all have unique characteristics, which make up our gorgeous world.

31 answers2024-02-09

Yes, Han Geng has not had surgery, and it is not that we like him to protect him. You can find some of his childhood ** on the Internet, Han Geng's nose has been like this since he was a child, I have a lot of them, you can compare some of them yourself! >>>More

25 answers2024-02-09

Oh, it should be a large proportion of psychological effects, and if there is a real bug, it won't only move when you don't move, and if it's a bug, it's moving like this, you should see it. >>>More

8 answers2024-02-09

National Games torch On May 9, the torch of the 11th National Games, named "Ruyi", was unveiled in Jinan. "Ruyi" is a symbol of auspiciousness, and the lotus is the city flower of Jinan. >>>More