preface

  • This article focuses on a special linear table structure in data structures: stack & queue
  • The content includes its characteristics, structure and so on. I hope you will like it.

directory


Schematic diagram


1. The stack

1.1 introduction


Schematic diagram

1.2 Storage Architecture

1.2.1 Sequential Storage Structure
  • Structure features The way to store the data elements of a linear table = a storage cell with contiguous addresses

Also called: sequential stack

  • Schematic diagram (Stack state description)


Schematic diagram

  • See the following figure for details of stack operations (loading, unloading and sharing)


Schematic diagram


1.2.2 Chain storage Structure

  • Structure features The way to store the data elements of a linear table = a segment of discontinuous, arbitrary storage location
  1. Storage = offline, separate, connected by Pointers
  2. Also called: chain stack
  • Structure diagram


Schematic diagram

  • See the figure below for details of the stack operation (push & push)


Schematic diagram

Note: Time complexity is O (1)

1.3 Comparison of Storage Structures


Schematic diagram


2. The queue

Next, let’s look at another special kind of linear table: queues

2.1 introduction


Queue. JPG


2.2 Storage Architecture

2.2.1 Sequential Storage Structure

  • Defines a sequential storage structure queue, also known as a circular queue

  • Why loop queues


Schematic diagram

  • Determine whether the queue is empty or full


Schematic diagram

2.2.2 Chain storage Structure

  • Define the chained storage structure of queues = single linked list of linear lists + tail in head out

Also called: chain queue

  • Structure that


Schematic diagram

  • Chain Queue Operation Instructions (queue entry & Queue exit)


Schematic diagram

2.3 Comparison of Storage Structures

That is, sequential storage structures (circular queues) versus chain storage structures (chain queues)


Schematic diagram


3. Summary

  • This article mainly explains a special linear table structure in data structure: stack & queue


Schematic diagram

  • I’ll continue to talk about data structures, but if you’re interested, stay tuned for Carson_Ho’s Android development notes

Thumb up, please! Because your encouragement is the biggest power that I write!

The Android event distribution mechanism is the most comprehensive and easy to understand solution for Android screen adaptation. It is the most comprehensive and easy to understand solution for Android screen adaptation. Android development: JSON introduction and the most comprehensive analysis method! BroadcastReceiver Is the most comprehensive version of Android’s BroadcastReceiver


Welcome to attentionCarson_HoJane books!

Share the dry things about Android development from time to time, the pursuit of short, flat, fast, but there is no lack of depth.