What is a sequential stack in a data structure?

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

    A sequential stack is a sequential storage structure of a stack, which refers to the sequential storage of elements in a stack from the bottom of the stack to the top of the stack with a continuous piece of storage space.

  2. Anonymous users2024-02-06

    A stack, as a data structure, is a special type of linear table that can only be inserted and deleted on one end. It stores data according to the first-in, first-out principle, 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 the data is ejected from the top of the stack when the data needs to be read. 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.

  3. Anonymous users2024-02-05

    One of my questions that has nothing to do with the storage structure is that there is a loop queue in the selection option, a linked list in b, a hash table in c, a stack d, and a solution in dBoth stacks and queues are logical structures, but circular queues are storage structures. That's how I understand it.

  4. Anonymous users2024-02-04

    Tree structure is an important nonlinear data structure of heterogeneity.

  5. Anonymous users2024-02-03

    It's all storage structures, so read the book Data Structures.

  6. Anonymous users2024-02-02

    The storage structure is different:

    The chain stack dynamically allocates memory to store data, so that no memory is wasted, and the stored data is not continuous.

    The sequential stack uses a fixed-size array to save data, which wastes memory when the amount of data is small, and there is a problem when there is too much, and the data is stored continuously.

    The specific differences between them are as follows:

    The implementation of the sequential stack lies in the use of the basic data structure of the array, the storage position of the elements in the array in memory is continuous, and the compiler requires us to determine the size of the array during the compilation period, so the memory usage efficiency is not high, and the overflow problem caused by the running out of array space cannot be avoided. After the system allocates memory to an array, it becomes unavailable for other tasks. In the case of the chain stack, the linked list is used to implement the stack, and the elements in the linked list are stored in discontinuous addresses, because it is a dynamic application for memory, so we can start with a very small memory space, and we can also return memory to the system when an item is not in use.

  7. Anonymous users2024-02-01

    Not necessarily.

    Stacks are divided into sequential stacks and chained stacks. The sequential stack is the sequential implementation of the stack, and the sequential stack is the stack implemented using the sequential storage structure.

    The data elements in the stack are stored sequentially in the storage space (array) with continuous addresses, and since the human stack and the off-stack operations are carried out at the top of the stack, and the position at the bottom of the stack is fixed, the position at the bottom of the stack can be set at the beginning of the array space. The position of the top of the stack changes with the incoming and out-of-stack operations, so an integer variable top is used to record the position of the current top element in the array.

    The advantage of using a chained stack is that it can overcome the low space utilization of the sequential stack implemented with arrays, but it needs to allocate additional pointer space for each stack element to store the pointer field.

  8. Anonymous users2024-01-31

    Uh, figure out two concepts: storage.

    Attack structure and logical structure.

    bai。The main storage structure is DU sequential storage and zhi chain storage (basic DAO two are OK). Logical structure refers to concepts such as linear tables (stacks and queues belong to the category of linear tables), graphs, and binary trees.

    Theoretically, all the logical structures can be implemented in the computer with the above two storage structures (of course, from the aspects of efficiency, storage space, etc., the storage structures used in the actual implementation of different logical structures will be biased) Take a similar example: cars and internal combustion engines, internal combustion engines mainly have gasoline engines and diesel engines, cars have trucks, cars, buses, etc., theoretically all cars can be powered by two kinds of internal combustion engines, I can say that the passenger car is a car, Passenger cars can be either gasoline-powered or diesel-driven. So the stack is a linear table, but the stack can be implemented either sequentially or chained.

  9. Anonymous users2024-01-30

    Sequential stack - The stack entry operation is constrained by the upper bound of the array, and the stack overflow can occur, and a storage unit with contiguous addresses is required.

    Chain stack - no address contiguity, convenient for multiple stacks to share storage units, and there is no stack overflow.

    Sequential queue - needs to have consecutive addresses and has false overflow phenomenon (need to change to a circular queue to solve false overflow) chain queue - especially suitable for the situation where the data element changes greatly, and there is no overflow problem caused by full queue.

  10. Anonymous users2024-01-29

    Uh, figure out two concepts: storage structure and logical structure. The main storage structures are sequential storage and chain storage (basically these two are OK).

    Logical structure refers to concepts such as linear tables (stacks and columns belong to the category of linear tables), graphs, and binary trees. Theoretically, all logical structures can be implemented in the computer with the above two storage structures (of course, from the aspects of efficiency, storage space, etc., considering the actual implementation, the storage structure of different logical structures will be biased) Take a similar example: cars and internal combustion engines, internal combustion engines mainly have two types of gasoline engines and diesel engines, cars have trucks, cars, buses, etc., theoretically all cars can be powered by two kinds of internal combustion engines, I can say that passenger cars are cars, Passenger cars can be either gasoline-powered or diesel-driven.

    So the stack is a linear table, but the stack can be implemented either sequentially or chained.

    No. The sequential storage method can be used to store not only linear structures, but also nonlinear structures, for example, a complete binary tree is a nonlinear structure, but its best storage method is sequential storage.

    Non-0 Because the sparse matrix only has non-0 yuan, I help you so much, you should add me to.

    A random memory structure means that a certain location can be read directly.

    If you want to connect a series structure, you need to start from the head node and iterate through the nodes to get the node you want.

    For example, arrays can be directly located to an element through the subscript of a friend, without the need to start from the first element and slowly traverse, which is a random storage structure.

    In sequential storage, generally an element is next to another element, let the storage position of the element with the serial number i be li, and the length of each element is d, then the storage position of the element with the serial number j is li + d(j - i), this formula is the same calculation time for all element serial numbers (subscripts), that is, the time to access any element is the same, so it is a random access.

    Of course, in C, there are naturally arrays, one after the other, and the conclusion is the same.

    Yes, both linear tables and sequential tables have linearity.

    No, the storage structure of the array itself is linear, that is, it is continuously stored, but the elements in the array can store indicators, which is the index array, and it can use the array to process nonlinear data. For example, if you store the address of each node in a connection series into the array, then access the array is to deal with non-linear data.

    Most of the polyethylene used now is a branched copolymer, and they are all added to some olefins in the polymerization process to form a branched chain, which is called a copolymer; If some olefins are not added into the blind copolymerization, it is called homopolymer and has no branched chains. In addition, although the molecule of polyethylene is a long chain, it has a crystalline structure and increases the branched chain, which strengthens the strength between the layers and improves the efficiency of polyethylene.

    Polyethylene is a linear structure, but it does not have branched chains.

    Of course, the connected series is not a sequential storage structure, the array is a generalization of the linear structure!

  11. Anonymous users2024-01-28

    Since the stack is a linear table with limited operations, the storage structure of the linear table is also applicable to the stack, and the linear table has two kinds of sequential storage and chain storage, so the stack also has two kinds of sequential storage and chain storage.

    2.Definition of sequential storage types of stacks: 1) Define sequential storage of stacks by dynamic memory allocation, and (1) Sequential storage representation of stacks.

    The sequential stack is essentially a simplification of the sequential table, because the position at the bottom of the stack is fixed, the position at the bottom of the stack can be set on the base address of the storage space, and the position at the top of the stack changes with the operation of entering and exiting the stack, so the top is used to indicate the next position of the current top element of the stack, which is usually called the top of the stack pointer.

  12. Anonymous users2024-01-27

    Don't complicate the data structure, in essence, the data structure is for different data organization, access and use of some common structs (classes) and methods (class methods) defined for different purposes, data structure is a guiding ideology, of course, stl, atl, boost library is ready-made.

    Queues are generally first-in, first-out, similar to queuing, and the purpose is the same as queuing, caching data, waiting for the CPU or some threads to be free before processing, first-come, first-served.

    The stack is a cup, but the data inside is solid, and you can't get the one you put in first, so you can only take out the later ones above and use them later, and then take the bottom ones. Stacks are rarely used, beginners can try to make a simple four-rule arithmetic calculator, because there are parentheses arithmetic-level reasons, stacks will be used.

    The tree is to store data in a certain order (generally size, generalized size, strings can also be compared), quickly find and read, but the insertion and deletion operations are slow and troublesome, the tree has many extensions, red and black trees, balanced trees, and so on.

    Linked lists are a bit like arrays, but they are flexible, the size is not fixed, and the memory blocks are not continuous, so you can delete some data or insert some new data at any time.

    The graph is too complex, the graph can be seen as a net, each data is a node, and each node may be connected to all other nodes, like a map? This structure is generally used in wayfinding algorithms (games, map navigation).

    Of course, if you don't care about speed, all of this can be done with arrays and some call methods you write, and beginners are advised to implement the data structure yourself.

Related questions
12 answers2024-04-02

A data structure is the way a computer stores and organizes data. >>>More

5 answers2024-04-02

I would like to introduce you to Yan Weimin's textbook "Data Structure" (C language version), which is currently a classic textbook with a good reputation in China. >>>More

8 answers2024-04-02

The creation sequence table is as follows:

by the array element a[0..n-1] to create a sequential table l. Each element in a is placed sequentially in a sequential table, and n is assigned to the length field of the sequential table. The algorithm is: >>>More

13 answers2024-04-02

This is a problem with queue operations. (Actually, you should give the definition of the queue operation function.) But I'm smart. Hey. You don't have to give. ) >>>More

6 answers2024-04-02

A data structure is the way a computer stores and organizes data. A data structure is a collection of data elements that have one or more specific relationships with each other. Often, a well-chosen data structure can lead to higher operational or storage efficiency. >>>More