Is stack, pile, stack a thing?

Updated on technology 2024-07-01
9 answers
  1. Anonymous users2024-02-12

    For the landlord to add the question:

    It's really inefficient, but why would you use a stack to get numbers?

    Different data structures are used differently, and stacks are mainly used for recursive programs.

    Stacks and stacks are the same.

    The stack is a bucket, and the one that is put in first takes it out, and the things under it can't come out until it comes out, as if you see an ugly person, and it is impossible to spit out the breakfast before today's lunch is spit out.

    Heaps are another thing, a high-level data structure.

    Heaps are things that are one and the other. top-heavy is not a heap, it is a heap if it is small at the top and big at the bottom. The heap is a binary tree, meeting the lower one is always larger than the one above.

    Compared with the binary lookup tree, it has both good and bad aspects: the good thing is that you don't need to look for the minimum value in the data at all, and it is directly the top one; The bad thing is that you can't do anything else except this. You have little control over the rest except for the top one.

    For example, if my girlfriend is lined up, I always choose the purest one, the one who is the least affected by those. Whenever I meet a new beauty, I put her in the right place in the team for my future entertainment. At this point, I only care about each insertion, taking the minimum, and deleting the minimum.

    This team can be optimized with a heap. Therefore, the heap also has an image name called the priority queue.

  2. Anonymous users2024-02-11

    It's not the same, stacks and stacks are one thing, heaps are another, there are different algorithms, they are all used for storing things, but they are suitable for different occasions.

  3. Anonymous users2024-02-10

    Stack, is a noun, a data structure, like a bottle with a bottom, and heap is a verb.

    The stack is to put the data into the station, and the first one to be put in is pressed below, and the next one is on top, so the first in and the last out.

  4. Anonymous users2024-02-09

    The parables upstairs are truly unprecedented.

    The upstairs buddy is good for doing abstraction.

  5. Anonymous users2024-02-08

    Heaps are a thing, and stacks are a thing. Stacks are two things.

  6. Anonymous users2024-02-07

    1. Stack space allocation.

    Stack (operating system): The operating system automatically assigns and releases the parameter values of functions, the values of local variables, etc. It behaves like a stack in a data structure.

    Heap (operating system): Generally distributed by the programmer, if the programmer does not release, the program may end by os**, similar to a linked list.

    2. Stack caching mode.

    Stacks use L1 caches, which are usually in storage at the time of invocation and are released as soon as they are called.

    The heap is stored in the L2 cache, and the lifecycle is determined by the VM's garbage burning algorithm (not once orphaned). So the speed of calling these objects is relatively low.

    3. Efficiency comparison.

    Stacks are automatically assigned by the system and are fast. But programmers have no control.

    The heap is the memory allocated by new, which is generally slow and prone to memory fragmentation, but it is the most convenient to use.

    4. Store content.

    Stack: In most C compilers, the arguments go into the stack from right to left, followed by the local variables in the function. Note that static variables are not stacked.

    When the function call ends, the local variables are first out of the stack, then the parameters, and finally the top of the stack pointer points to the return address of the function, which is the address of the next instruction in the main function, and the program continues to run from this point.

    Heap: Generally, the size of the heap is stored in an old Kai imaginary byte at the head of the heap. The specifics of the heap are arranged by the programmer.

  7. Anonymous users2024-02-06

    Satisfactory answer enthusiastic to ask friends 2011-06-22Stack is actually two concepts in the data results, is the way to store data, heap: the order is arbitrary; Stack: Last-in first-out.

    If you want to talk about usefulness, that is, when writing **, sometimes data access must have a specified order, this is your own definition, and then use the order of heap or stack or queue according to the characteristics of the usefulness of the program you write Follow-up question: When designing a program, why do you need to reassign the stack pointer sp? Answer:

    Isn't this initialization?

    A stack is a special storage area whose primary function is to temporarily store data and addresses, and is often used to protect breakpoints and the field. It is characterized by accessing data according to the principle of first-in, last-out, where the in-and-out refers to the in-stack and out-stack operations. Some of the cells of the 80C51 on-chip RAM can be used as stacks.

    There is an 8-bit stack pointer register SP dedicated to indicating which cell of the current stack top is the on-chip RAM. After the 80C51 microcontroller system is reset, the initial value of SP is 07H, that is, the information will be stacked from the 08H unit of the internal RAM. However, the stack of the 80C51 series is not fixed and can be changed by changing the value of the SP register by software.

    To avoid the working register area and the bit-addressing area, the initial value of SP can be set to an address value of 2fh or greater. If the CPU is to use two sets of working registers in operation, the initial value of the SP should be at least 0FH or greater if no bit variables are used; If a bit variable is used, the initial value of SP should be at least 2fh or greater; The KeilC51 compiler automatically calculates the initial setpoint of the SP without the programmer's concern.

  8. Anonymous users2024-02-05

    Heaps and stacks are two different concepts.

    The memory allocated on the heap (HEAP) is not released by the system and is dynamically allocated. The system automatically frees the memory allocated on the stack, which is statically allocated. The runtime stack is called the stack.

    The allocation of the stack is from the high address of the memory to the low address, while the heap is the opposite. The memory allocated by Malloc or New is the memory allocated from the HEAP, and the memory allocated from the HEAP must be released by the programmer himself, and the free is used to release it, otherwise the memory will be occupied all the time and cannot be released, and there will be a "memory leak". This will cause the system to have less and less allocable memory, causing the system to crash.

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

    Imagine a bamboo tube with a small diameter, open at one end and closed at the other. There are several numbered balls, and the diameter of the balls is slightly smaller than that of the bamboo tube. Now put the different numbered balls into the bamboo tube, and you can find a pattern:

    The ball that is put in first can only be taken out later, and conversely, the ball that is put in later can be taken out first. So "first-in, last-out" is the characteristic of this structure.

    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.

    Stack registers are the registers that hold the stack.

  9. Anonymous users2024-02-04

    In the computer field, stacking is a concept that cannot be ignored, but many people, even computer professionals, do not make it clear that stacks are actually two data structures. A stack is a data structure in which data items are arranged sequentially, and data items can only be inserted and deleted at one end, called the top of the stack. Key points:

    Heap: Order: Last-in First-Out

    I am a ——— who graduated from Shanghai Quanding Software College

Related questions
18 answers2024-07-01

No. The stomach is an organ, and the stomach is the common name for it, and there are many organs in it, including the stomach, and the two are not equal.

6 answers2024-07-01

Latin name, scientific name] :p Rimula malacoides English name: oriental cherry grass alias]: primrose, primrose, annual flower. >>>More

10 answers2024-07-01

In many places in life, the figure of the zipper is inseparable, which is a miraculous invention that can connect two unrelated pieces of fabric or other substances together by relying only on two rows of metal teeth or plastic rulers, and can also be controlled by sliding pieces to disconnect. Many people ignore the magic of zippers because they are too common in life, but if you think about the role that zippers play in life, it is extraordinary. So how did such an amazing invention come about? >>>More

19 answers2024-07-01

Lying silkworm refers to a small part of the bulge under the eyelashes when laughing, and the eye bag is the puffiness of the lower eyelid, compared to the lying silkworm, the eye bag is a large part of the puffy state under the eye. Lying silkworms are not the same thing as eye bags, which can make people look friendly, but eye bags can make people look old and tired. If you want to reduce eye bags, you can try to use icearu's Haiying Essence Moisturizing Eye Mask to massage the eye area** for 10-15 minutes, wait for ** to be completely absorbed before washing it off with water, and use the eye mask for a long time to find that the eye area ** is gradually rejuvenated.

23 answers2024-07-01

If you meet a man who loves to get angry and smash things, you should stay away from him, this kind of man who likes who is unlucky, men should be generous, and they should care about women's hearts, so that men can be liked. Therefore, women should see the character of men clearly.