Data structure - the basic concepts of the queue stack and

1. stacks and queues the definition and characteristics

1.1 Stack

  • Definition: only one end of the table ( stack for insert and delete operations linear form).
  • Logical structure: the same linear form, is still one relationship.
  • Storage structure: with a sequence of stack or link stack memory can be, but is more commonly in the order of the stack.
  • Operation rules: only in the top of the stack operation, and when the access node in accordance with the last in, first out (LIFO) or last-out (FILO) principle.
  • Implementations: the key is pushed and popped write functions embodied in different stacks vary in sequence or the link stack. There are basic operations stack, the stack, the top element value read, to build the stack, the stack is determined full stack waited in vain.

1.2 queue

  • Definition: only one end of the table ( the tail insert), at the other end ( head-of delete operations linear form).
  • Logical structure: the same linear form, is still one relationship.
  • Storage structure: with the queues or chain team storage available.
  • Operation rule: First In First Out (FIFO).
  • Implementation: The key is to prepare the team and the team functions, depending on the specific implementation team or a different order and a different chain team.

2. The difference between the stacks, queues general linear table

  • Stack, queue is a special (operations are limited) linear form, the difference: only different in that the operation rules .

​​​​​

Guess you like

Origin blog.csdn.net/qq_22847457/article/details/94351307