基础学习
未读什么是链表链表由若干节点构成,节点之间有链接,链接末尾没有节点,指向空null.
链表的实现需要定义:
泛型变量作为节点数据;
下一个节点的引用;
头节点。
代码实现单链表using System;using System.Text;namespace AlgorithmTest08_链表{ /// <summary> /// 单链表 /// </summary> /// <typeparam name="T"></typeparam> public class LinkedList1<T> { /// <summary> /// 节点类 /// </summary> private class Node { public T t;//类型 public Node next;//下一个 ...
关于拆装箱
装箱:值类型数据转换为引用类型。装箱时,生成的是全新的引用对象,这会有时间损耗,因此装箱操作效率不高。
拆箱:引用类型数据转换为值类型数据。
利用装箱和拆箱功能,可通过允许值类型的任何值与Object 类型的值相互转换,将值类型与引用类型链接起来。
值类型只会在栈中分配;
引用类型分配内存与托管堆;
使用泛型可以避免拆装箱操作。
代码演示:
using System;using System.Collections;using System.Collections.Generic;using System.Diagnostics;namespace AlgorithmTest07_拆装箱{ class Program { static void Main(string[] args) { int n = 100000000; Stopwatch t1 = new Stopwatch();//计时器 Stopwatch t2 = new S ...
Hexo
未读
之前我用的主题是icarus,研究了很久发现没法在主页固定音乐播放器,网上找了很多全是关于next的教程;
一气之下把主题换成了next,换过来之后我觉得配色之类的过于简约,有点不太喜欢;
于是打算先换换配色,搜了一圈发现那些diy主题的攻略全是旧版本的,和新版不同;
于是就有了这篇文章。
NexT version: 8.13.1
文件目录颜色目录source\css\_variables目录base.styl文件
主题样式\source\css\_variables目录Gemini.styl文件(继承自Pisces)
\source\css\_variables目录Pisces.styl文件
改背景色我的博客主体会偏明亮一些,个人比较喜欢橙色黄色蓝色这类比较鲜艳的颜色,所以先改背景色。
找到主题目录下的\source\css\_variables文件Gemini.styl,这个文件里还有挺多主题相关可以配置。
$body-bg-color = #f6d365;
渐变色代码可以
https://webgradients.com
这个网站中复制,非常好用,不过最好在\source\ ...
unity
未读教程来自b站阿严:https://www.bilibili.com/video/BV1rL4y1W7KH
成果展示:
【[unity]平台跳跃类demo】 https://www.bilibili.com/video/BV1AK411Q7ry?share_source=copy_web&vd_source=644eac695af0d52dcffdec474d1423b1
一 项目的创建和管理插件
删除不需要的插件,安装需要的插件,删除后插件内容:
1.1 安装:
Cinemachine,虚拟相机插件。
Post Processing,后处理插件。
Input System,新的输入系统插件。
1.2 安装完成后图:
1.3 导入资源包这里我使用的是自己在unity商店买的资源包,替换了unity酱,想要做点不一样的。
二 状态机系统创建接口文件和状态机类
2.1 Istate接口using System.Collections;using System.Collections.Generic;using UnityEngine;public interfac ...
基础学习
未读顺序表
定义接口namespace AlgorithmTest06_List{ interface IListDS<T> { int GetLength();//求长度 void Chear();//清空 bool IsEmpty();//判断线性表是否为空 T Add(T item);//添加 void Insert(int index, T item);//插入 T Delete(int i);//删除 T this[int i] { get; }//定义索引器 获取元素 T GetElem(int i);//取表元 T Set(int i, T item);//修改 int IndexOf(T value);//按值查找 void Remove(T value);//根据值删除 }}
实现接口/// <summary>/// ...
Hexo
未读问题hexo新建文章时,头部默认是只有title和date,每次要添加类别都要重新写。
解决方法:根目录下找到scaffolds文件夹下的post.md就可以编辑模板了
Hexo
未读解决Hexo博客没有auto_excerpt的问题1:使用npm安装hexo-excerptnpm install hexo-excerpt --save
2:在站点配置文件中添加excerpt: depth: 5 excerpt_excludes: [] more_excludes: [] hideWholePostExcerpts: true
置顶功能1.替换首页生成器,在博客根目录中使用以下命令:
# your_blognpm uninstall hexo-generator-index --save # 卸载原来的首页生成器npm install hexo-generator-index-pin-top --save # 安装有置顶功能的首页生成器
2.在博客根目录 your_blog/_config.yml 的配置文件中设置文章排序方式:
index_generator: path: '' per_page: 10 order_by: -top -date
3.对于想要置顶的文章,在 Markdown 文件开头设置 top: true
---title: article's tiletop: true---markdown content
4.打开文件目录layout\_partials\post\post-meta.njk,搜索post-meta在里面添加如下内容用以显示图标:
{% if post.top %} <spa ...
栈(Stack)
栈中元素是从上到下加入的,即“后进先出”
栈的应用十进制转二进制
Console.WriteLine("请输入一个十进制数字"); int num = int.Parse(Console.ReadLine()); Stack<int> Remainder = new Stack<int>(); while (num != 0) { Remainder.Push(num % 2); num /= 2; } foreach (var item in Remainder) { Console.ForegroundColor = ConsoleColor.DarkBlue; Console.Write(item); } Console.ReadKey();
打印结果:
数组实 ...


