![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
笔记
O0oLin
这个作者很懒,什么都没留下…
展开
-
queue的实现
using System.Collections;using System.Collections.Generic;using UnityEngine;public class 实现队列 : MonoBehaviour{ class MyQueue { class QueueData { public QueueData nextItem; public object topData;原创 2021-08-20 20:30:46 · 77 阅读 · 0 评论 -
stack的实现
using System.Collections;using System.Collections.Generic;using UnityEngine;public class 实现栈 : MonoBehaviour { class MyStack { class StackData { public StackData nextItem; public object topData;原创 2021-08-20 20:16:22 · 64 阅读 · 0 评论 -
数据结构_queue
using System.Collections;//队列在此空间using System.Collections.Generic;using UnityEngine;public class 队列 : MonoBehaviour { //先进先出 Queue queue=new Queue(); Queue<int> queue2=new Queue<int>(); void Start() { queue.Enq原创 2021-08-20 19:52:21 · 56 阅读 · 0 评论 -
数据结构_stack
using System.Collections;using System.Collections.Generic;using UnityEngine;public class 堆栈 : MonoBehaviour { //stack 先进后出的对象集合 Stack st1 = new Stack(); void Start() { st1.Push("a"); st1.Push("b"); st1.Push("c")原创 2021-08-20 16:56:48 · 65 阅读 · 0 评论 -
数据结构_链表
using System.Collections;using System.Collections.Generic;//LinkedList LinkedListNode在该空间using UnityEngine;public class 链表 : MonoBehaviour { //双向链表 LinkedList<int> linList = new LinkedList<int>(); LinkedListNode<int> node原创 2021-08-20 16:25:28 · 72 阅读 · 0 评论 -
数据结构_hashset
using System.Collections;using System.Collections.Generic;using UnityEngine;public class 哈希set : MonoBehaviour { //包含不重复项的无序列表 HashSet<int> hs1 = new HashSet<int>(); HashSet<int> hs2 = new HashSet<int>(); void S原创 2021-08-20 15:50:42 · 58 阅读 · 0 评论 -
数据结构_hashtable
using System.Collections;using System.Collections.Generic;using UnityEngine;public class 哈希Table : MonoBehaviour { Hashtable ht1 = new Hashtable(); // Use this for initialization void Start () { ht1.Add("1", 100); ht1.Add(1, 99);原创 2021-08-20 11:04:58 · 57 阅读 · 0 评论 -
array数组
//数组是用来存储数据的集合//1 元素类型相同//2 固定长度//3 顺序集合int[]array1;int[]array2 = new int[3]{1,2,3};int[]array3 = {1,2,3,4,5};private void Start(){ array1=new int[3]; Debug.Log(array1[0]); array1[0]=5; Debug.Log(array1[0]); Debug.Log("***********"); Debug.原创 2021-08-20 08:51:39 · 64 阅读 · 0 评论 -
arrayList(动态数组)&List<>——两者十分相似
//动态数组(ArrayList)对象的有序集合//动态数组会自动重新调整它的大小//可以使用索引在指定的位置添加和移除项目,它也允许在列表中进行动态内存分配ArrayList arraylist1=new ArrayList();int[]array1=new int[]{1,2,3,4};void Start(){ arraylist1.Add(45); arraylist1.Add(25); arraylist1.Add(12); Debug.Log(arraylist1[0]);原创 2021-08-20 09:44:13 · 113 阅读 · 0 评论