跳至主要內容
Mr. Caryam

Mr. Caryam

Hello, everyone, welcome to my digital garden🎉

I will push my writings here in spare time as possible.

Anyway, I hope you get harvests here and that is realy my pleasure😄

日语基础入门

日语基础入门

本文内容节选取自圆圆老师的入门8节课

第一节课

  • 日语文字由来、日语构成(平假名、片假名、罗马音)

  • 五十音(平假名版)

提示

  1. 发音嘴型要小,发声位置要靠前
  2. 送气音和不送气音用手掌放在嘴边感受气流来区分,送气音气流向外喷,不送气音气流往回(内)收
  3. 行的记忆口诀:俺看桑塔纳,喊妈呀啦哇(河马压了蛙)
  4. 发音要注意练习,注意特殊发音(

Caryam...大约 1 分钟
常见问题

表格常见问题

1. 图片无法自适应

在表格单元格中插入图片,图片可能无法自适应单元格宽度,而是显示了图片的原始尺寸。如下图所示:

解决方法是在插入图片前,先固定表格列宽,具体步骤是:

  1. 选中表格
  2. 打开布局(Layout)选项卡
  3. 点击自动调整(AutoFit)
  4. 选择固定列宽(Fixed Column Width)

2. 复制表格至新文档显示不全

这是由于复制的表格尺寸大于新文档尺寸所致,如下图所示:


Caryam...大约 3 分钟
树的性质

结点数=总度数+1

度为m 的树与 m叉树 的区别

度为m 的树:

  • 任意结点的度 <=m (最多m个孩子)
  • 至少有一个结点度 =m (有m个孩子)
  • 一定是非空树,至少有 m+1 个结点

m叉树

  • 任意结点的度 <=m (最多m个孩子)
  • 允许所有结点的度都 <m
  • 可以是空树

Caryam...小于 1 分钟
树的基本概念

笔记内容来源于B站数据结构课程

定义

树是 n(n>=0)结点的有限集合,n=0 时,称为空树,这是一种特殊情况。在任意一颗非空树中应满足:


Caryam...大约 2 分钟
语言

Caryam...小于 1 分钟
单链表

单链表

/**
 * 单链表
 */
class SingleLinkedList {
  constructor() {
    this._head = new LNode(); // 头结点
    this._len = 0;
  }

  /**
   * 获取链表长度
   * @returns
   */
  length() {
    return this._len;
  }

  /**
   * 插入元素
   * @param {number} i 位序
   * @param {any} data 数据
   * @returns
   */
  insert(i, data) {
    if (i < 1) {
      return false;
    }

    let p = this._head; // 当前结点指针
    let j = 0; // 当前结点位序
    // 遍历链表,找到第i-1个结点
    while (p != null && j < i - 1) {
      p = p.next;
      j++;
    }

    // i值不合法,过界
    if (p === null) {
      return false;
    }

    return this.insertNextNode(p, data);
  }

  /**
   * 在指定结点后插入元素
   * @param {*} ref
   * @param {*} data
   * @returns
   */
  insertNextElement(ref, data) {
    const newNode = new Node(data);
    return this.insertNextNode(ref, newNode);
  }

  /**
   * 在指定结点后插入元素结点
   * @param {LNode} ref 参考结点
   * @param {*} target 数据结点
   * @returns
   */
  insertNextNode(ref, target) {
    if (ref === null) {
      return false;
    }

    target.next = p.next;
    p.next = target;
    this._len++;
    return true;
  }

  /**
   * 元素的前插操作
   * @param {LNode} ref 参考结点
   * @param {*} data 数据
   * @returns
   */
  insertPriorElement(ref, data) {
    const newNode = new LNode(data);
    return this.insertPriorNode(ref, newNode);
  }

  /**
   * 结点前插操作
   * @param {LNode} ref 参考结点
   * @param {LNode} target 插入结点
   * @returns
   */
  insertPriorNode(ref, target) {
    if (ref === null) {
      return false;
    }

    // 后插操作
    this.insertNextNode(ref, target);

    // 将结点数据呼唤,实现逻辑上的前插
    const tmp = target.data;
    target.data = ref.data;
    ref.data = tmp;

    return true;
  }

  /**
   * 删除位序所指结点
   * @param {number} i 位序
   * @returns
   */
  remove(i) {
    let p = this._head;
    let j = 0;

    while (p !== null && j < i - 1) {
      p = p.next;
      j++;
    }

    // 位序溢出
    if (p === null) {
      return false;
    }
    if (p.next === null) {
      return false;
    }

    let q = p.next;
    p.next = q.next;
    // free q
    q.next = null;
    this._len--;

    return q;
  }

  removeNode(node) {
    // 如果是最后一个结点(默认node存在列表的情况下)
    if (node.next === null) {
      this.remove(this.length());
    }
  }
}

/**
 * 链表结点
 */
class LNode {
  constructor(data) {
    this.data = data;
    this.next = null;
  }
}

Caryam...大约 1 分钟
2
3
4