数据结构
爱吃奶酪的松鼠丶
QQ:1301001603
展开
-
C#链表栈的底层实现
和之前文章数组栈类似。1.定义栈接口using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 数组栈{ public interface IStack<E> { //栈中元素数量 int Count { get; } //是否为空原创 2021-04-12 23:41:20 · 416 阅读 · 0 评论 -
C#底层模拟实现Stack数组栈,栈的先进后出。
对于栈,普通用户只需要能够获取栈的元素数量,是否为空,增删查,就可以了,所以我们定义一个规范。*====接口*定义一个泛型接口IStackusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 数组栈{ interface IStack<E> { //栈中元素数量原创 2021-04-11 23:58:59 · 491 阅读 · 0 评论 -
C#装箱和拆箱,泛型和非泛型比较。
装箱:是值类型转换为引用类型拆箱:引用类型转换为值类型 引用类型:任何称为类 的类型都是引用类型,使用class修饰 如:string object 值类型:所以值类型都称为结构或者枚举,使用struct或enum修饰 如:int float double char简单的了解了什么是装箱拆箱后现在我们来看ArrayList和泛型的一个简单对比 看代码using System;using System.Colle原创 2021-04-05 18:06:37 · 333 阅读 · 0 评论 -
C#动态数组ArrayList类的实现,动态扩容动态缩容实现。增删改查的底层实现
主要实现动态扩容动态缩容,增删改查的底层实现。代码有注释。可以直接复制类去跑。using System;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace DataStucte{ class Program { static System.Di原创 2021-04-02 00:11:56 · 815 阅读 · 0 评论