当前位置:网站首页>Array structure collation
Array structure collation
2022-06-25 10:34:00 【m0_ forty-nine million four hundred and seventy-one thousand si】
What is an array structure ?
The array structure is Computer Storage 、 organization The way of data . Data structures refer to the relationships between There is Of one or more specific relationships data Set . The structure includes Logical structure and Physical structure
Data Logical structure Include 4 Kind of :
(1) aggregate : Between data elements except Same data type Nothing else
(2) Linear structure : Between the data elements is one-on-one —— The linear table , Stack , queue
(3) A tree structure : Between the data elements is One to many The relationship between
(4) Figure structure : The data element is Many to many The relationship between
Physical structure Include Sequential storage And Chain store :
(1) The sequential storage structure is Use a continuous storage space To store data elements , Random access is possible , High access efficiency .
(2) The chain storage structure is Use any storage space To store data , No random access , Inefficient access
The head pointer and Head node The difference between :
(1) The head pointer : yes Point to First node Storage location The pointer to , have identification effect , The pointer head is Linked list Necessary elements of , Whether the list is empty or not , The head pointer exists
(2) Head node : yes Put it in First element Before the node , Easy to do before the first element node Insert and Delete The operation of , The head node is not a required element of the linked list , not essential , The data field of the header node may not store any information
Linear structure Characteristics :
(1) There must be a unique in the set “ First element ”
(2) There must be a unique in the set “ The last element ”
(3) Except for the last element , Other data elements have unique “ The subsequent ”
(4) Except for the first element , Other data elements have unique “ Forerunner ”
Array and Linked list The difference between :
(1) from Logical structure Come on : Array Storage length yes Fix Of , Can't adapt to Dynamic increase and decrease of data . Linked list can Dynamic allocation Storage space to adapt to the dynamic increase and decrease of data , Easy to insert and delete
(2) from access Look at : An array is a contiguous piece of storage space in memory , The array can be accessed randomly through the array subscript , Access efficiency is high . A linked list is a linked storage structure , Storage space does not have to be contiguous , It can be arbitrary , Access must be done from front to back , The access efficiency is lower than that of array .
If from the first i Insert multiple elements at multiple locations , For arrays, each insertion requires moving the elements back , The time complexity of each time is O(n), The single linked list only needs to be found for the first time i Location The time complexity is O(n), The time complexity of other insertions and deletions is O(1), Improve the efficiency of insertion and deletion
Single chain list The structure and Sequential storage structure
(1) When deleting and inserting , Sequential storage structures need to move elements every time , The total time complexity is O(n2)
(2) The chain storage structure is determined i After the pointer of position , Its time complexity is only O(1).
The order The storage structure needs to pre allocate memory space , So it will cause space waste or overflow . The chain The storage structure does not require pre allocated storage space , There is no limit to the number of elements .
Stack and queue The difference between :
(1) queue Is allowed to In one paragraph Insert At the other end Delete Of The linear table , For the elements entering the queue, press “ fifo ” Rule processing of , stay Header To delete , stay Tail Insert .
(2) Stack It can only At the end of the table For insertion and deletion The linear table , For elements inserted into the stack, press “ Last in, first out ” Rule processing of , Both insert and delete are performed at the top of the stack , Because the stack entry and exit are carried out at the top of the stack , So there has to be a size Variable records the current stack size , When entering the stack size Cannot exceed array length ,size+1, Stack is not empty when exiting ,size-1
Reference resources : Data structure interview questions and answers sorting _けいしん The blog of -CSDN Blog _ Data structure interview questions
边栏推荐
- Detailed explanation of Android interview notes handler
- CSRF攻击
- i++ 和 ++i的真正区别
- 性能之内存篇
- Flask blog practice - realize the latest articles and search in the sidebar
- Redis(二)分布式锁与Redis集群搭建
- String longest common prefix
- tokenizers>=0.11.1,!=0.11.3,<0.13 is required for a normal functioning of this module,
- OODA working method
- WPF binding expression and binding data source (I)
猜你喜欢
Opencv learning (I) -- environment building
网络协议学习---LLDP协议学习
OpenCV学习(一)---环境搭建
ScheduleMaster分布式任务调度中心基本使用和原理
P2P network core technology: Gossip protocol
Shardingsphere proxy 5.0 sub database and sub table (I)
XSS攻击
西门子PLCS7-200使用(一)---开发环境和组态软件入门
This is enough for request & response
Basic use and principle of Minio
随机推荐
如何在Microsoft Exchange 2010中安装SSL证书
NetCore性能排查
学会自学【学会学习本身,比学什么都重要】
WPF binding expression and binding data source (I)
[paper reading | deep reading] drne:deep recursive network embedding with regular equivalence
原生小程序开发注意事项总结
虚幻引擎图文笔记:使用VAT(Vertex Aniamtion Texture)制作破碎特效(Houdini,UE4/UE5)上 Houdini端
Kotlin implements a simple login page
服务端渲染
成长:如何深度思考与学习
【系统分析师之路】第六章 复盘需求工程(综合知识概念)
How to make small programs on wechat? How to make small programs on wechat
垃圾回收机制
一文了解Prometheus
Linked list delete nodes in the linked list
Summary of considerations for native applet development
Basic use and cluster construction of consult
Can two Mitsubishi PLC adopt bcnettcp protocol to realize wireless communication of network interface?
Flutter adds event listening | subscription
Redis(二)分布式锁与Redis集群搭建