【算法练习】leetcode链表算法题合集

在这里插入图片描述

链表总结

  1. 增加表头元素
  2. 倒数节点,使用快慢指针
  3. 环形链表(快慢指针)
  4. 合并有序链表,归并排序
  5. LRU缓存

算法题

删除链表元素

删除链表中的节点

LeetCode237. 删除链表中的节点

复制后一个节点的值,删除后面的节点(1->5->3->4,删除5的话,先调整为1->3->3->4,再删除第二个3的节点)

class Solution {
    public void deleteNode(ListNode node) {
        node.val = node.next.val;
        node.next = node.next.next;
    }
}
删除链表的倒数第 N 个结点

LeetCode19. 删除链表的倒数第 N 个结点

快慢节点,使用虚拟节点,删除节点

当fast的next节点到了链表外,slow的next节点是第n个节点。找到slow的next节点,删除。

class Solution_LC19 {
    public ListNode removeNthFromEnd(ListNode head, int n) {
        ListNode dummy = new ListNode(-1);
        dummy.next = head;
        ListNode slow = dummy;
        ListNode fast = dummy;
        for (int i = 0; i < n; i++) {
            fast = fast.next;
        }
        while (fast.next != null) {
            fast = fast.next;
            slow = slow.next;
        }
        slow.next = slow.next.next;
        return dummy.next;
    }

}
删除排序链表中的重复元素

LeetCode83 删除排序链表中的重复元素

和当前节点比较值,相同则删掉,不同则下一个节点

class Solution_LC83 {
    public ListNode deleteDuplicates(ListNode head) {
        ListNode cur = head;
        while (cur != null) {
            int val = cur.val;
            if (cur.next != null && cur.next.val == val) {
                cur.next = cur.next.next;
            } else {
                cur = cur.next;
            }
        }
        return head;
    }
}
删除排序链表中的重复元素 II(**)

LeetCode82. 删除排序链表中的重复元素 II

定义两个节点。cur节点是用来比较的节点,pre节点是用来删除的。找到cur节点,该节点和next节点不一致,pre.next=cur,等于是删除了pre和cur之间的元素。

class Solution {
    public ListNode deleteDuplicates(ListNode head) {
        ListNode dummy = new ListNode(-1);
        dummy.next = head;
        ListNode pre = dummy;
        ListNode cur = head;
        while (cur != null && cur.next != null) {
            int x = cur.val;
            if (cur.next.val == x) {
                while (cur != null && cur.val == x) {
                    cur = cur.next;
                }
                pre.next = cur;
            } else {
                cur = cur.next;
                pre = pre.next;
            }
        }
        return dummy.next;
    }
}

旋转链表

反转链表

LeetCode206. 反转链表

头插法。pre和cur不断向后移动,直到cur为空,pre为最后一个节点(遍历顺序的最后一个)。

class Solution {
    public ListNode reverseList(ListNode head) {
        ListNode pre = null;
        ListNode cur = head;
        while (cur != null) {
            ListNode next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }
}
K 个一组翻转链表

LeetCode25. K 个一组翻转链表

  • 获取k个节点一组的链表

  • 翻转链表

  • pre的后面一个节点是start,end的最后一个节点是next。

class Solution {
    public ListNode reverseKGroup(ListNode head, int k) {
        ListNode dummy = new ListNode(-1);
                dummy.next = head;
        ListNode pre = dummy;
        ListNode end = dummy;

        while (end.next != null) {
            for (int i = 0; i < k&&end!=null; i++) {
                end = end.next;

            }
            if (end == null) {
                    break;
                }
            ListNode next = end.next;
            ListNode start = pre.next;
            end.next = null;

            pre.next = reverse(start);

            start.next = next;
            pre = start;
            end = start;
        }
        return dummy.next;
    }

    private ListNode reverse(ListNode head) {
        ListNode pre = null;
        ListNode cur = head;
        while (cur != null) {
            ListNode next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;

        }
        return pre;
    }
}
LeetCode61. 旋转链表

LeetCode61. 旋转链表.

  • 获取链表的尾结点

  • 尾结点连接头节点

  • 找到切割点(切割点的前一个节点)

  • 切割。获取next节点,将当前节点的next置为空,切断。

class Solution {
    public ListNode rotateRight(ListNode head, int k) {
        if (k == 0 || head == null || head.next == null) {
            return head;
        }
        ListNode cur = head;
        int n = 1;
        while (cur.next != null) {
            cur = cur.next;
            n++;
        }

        int add = n - k % n;
        if (add == n) {
            return head;
        }
        cur.next = head;
        while (add > 0) {
            cur = cur.next;
            add--;
        }

        ListNode next = cur.next;
        cur.next = null;
        return next;
    }
}

交换链表节点

LeetCode24. 两两交换链表中的节点(⭐️高频)

LeetCode24. 两两交换链表中的节点

定义虚拟头结点

获取可以交换的节点,进行节点操作

将node1节点置为前置结点,进行下一轮操作

class Solution {
    public ListNode swapPairs(ListNode head) {
        ListNode dummy = new ListNode(-1, head);
        ListNode cur = dummy;

        while (cur.next != null && cur.next.next != null) {
            ListNode node1 = cur.next;
            ListNode node2 = node1.next;
            ListNode next = node2.next;
            cur.next = node2;
            node2.next = node1;
            node1.next = next;
            cur = node1;
        }
        return dummy.next;
    }
}

环形/相交/回文链表

LeetCode141. 环形链表(腾讯)

LeetCode141. 环形链表(腾讯)

使用快慢指针,如果快指针最后到达慢指针,则存在环。

public class Solution {
 public boolean hasCycle(ListNode head) {
        ListNode fast = head;
        ListNode slow = head;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
            if (fast == slow) {
                return true;
            }
        }
        return false;
    }
}
LeetCode142. 环形链表II

LeetCode142. 环形链表II.

快慢指针

a+b+n(b+c)=2(a+b) --> a=(n-1)(b+c)+c

public class Solution {
    public ListNode detectCycle(ListNode head) {
        ListNode fast = head;
        ListNode slow = head;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
            if (slow == fast) {
                ListNode node1 = head;
                ListNode node2 = fast;
                while (node1 != node2) {
                    node1 = node1.next;
                    node2 = node2.next;
                }
                return node1;
            }
        }
        return null;
    }
}
LeetCode160.相交链表

160. 相交链表

要进行临界值判断

相交的链表后面一段是公共的,a+b+c=c+b+a。

public class Solution {
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        if (headA == null || headB == null) {
            return null;
        }
        ListNode p1 = headA;
        ListNode p2 = headB;
        while (p1 != p2) {
            p1 = p1 == null ? headB : p1.next;
            p2 = p2 == null ? headA : p2.next;
        }
        return p1;
    }
}
LeetCode234. 回文链表

234. 回文链表

寻找中间节点,并反转前面列表

pre是反转链表的头结点,slow是后面链表的头结点。比较节点的值,判断是否回文

class Solution {
    public boolean isPalindrome(ListNode head) {
                //1-2-3-2-1
        ListNode fast = head;
        ListNode slow = head;
        ListNode pre = null;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            ListNode next = slow.next;
            slow.next = pre;
            pre = slow;
            slow = next;
        }
        if (fast != null) {
            slow = slow.next;
        }
        while (pre != null && slow != null) {
            if (slow.val != pre.val) {
                return false;
            } else {
                slow = slow.next;
                pre = pre.next;
            }
        }
        return true;
    
    }
}

链表合并

LeetCode2: 两数相加

LeetCode2: 两数相加

对应数位的值相加,计算当前节点以及向上的值。

class Solution {
    public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        int carry = 0;
        while (l1 != null || l2 != null || carry != 0) {
            int sum = (l1 == null ? 0 : l1.val) + (l2 == null ? 0 : l2.val) + carry;
            carry = sum / 10;
            ListNode tmp = new ListNode(sum % 10);
            cur.next = tmp;
            cur = tmp;
            l1 = l1 == null ? null : l1.next;
            l2 = l2 == null ? null : l2.next;
        }
        return dummy.next;
    }
}
LeetCode445: 两数相加II

LeetCode445: 两数相加II

使用堆栈,用于顺序相反获取值

链表的拼接和上一题不同。上一题是不断往链表后面添加元素;这一题是不断往前面添加元素。

class Solution {
    public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
        Stack<Integer> stack1 = new Stack<>();
        Stack<Integer> stack2 = new Stack<>();
        while (l1 != null) {
            stack1.push(l1.val);
            l1 = l1.next;
        }
        while (l2 != null) {
            stack2.push(l2.val);
            l2 = l2.next;
        }
        int carry = 0;

        ListNode cur = null;
        while (!stack1.isEmpty() || !stack2.isEmpty() || carry != 0) {
            int sum = (stack1.isEmpty() ? 0 : stack1.pop()) + (stack2.isEmpty() ? 0 : stack2.pop()) + carry;
            carry = sum / 10;
            ListNode tmp = new ListNode(sum % 10);
            tmp.next = cur;
            cur = tmp;

        }
        return cur;

    }
}
LeetCode21: 合并两个有序链表

21. 合并两个有序链表

挨个遍历比较大小,是最容易想到的方案

使用递归。当l1.val < l2.vall1.next = mergeTwoLists(l1.next, l2);

class Solution {
    public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        while (list1 != null && list2 != null) {
            if (list1.val < list2.val) {
                cur.next = new ListNode(list1.val);
                cur = cur.next;
                list1 = list1.next;
            } else {
                cur.next = new ListNode(list2.val);
                cur = cur.next;
                list2 = list2.next;
            }
        }
        if (list1 != null) {
            cur.next = list1;
        } else {
            cur.next = list2;
        }
        return dummy.next;
    }
}
LeetCode23: 合并K个排序链表

23. 合并 K 个升序链表

挨个遍历处理

class Solution {
    public ListNode mergeKLists(ListNode[] lists) {
        ListNode ans = null;
        for (int i = 0; i < lists.length; i++) {
             ans =mergeTwoLists(ans, lists[i]);
        }
        return ans;
    }

    public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
        if (list1 == null || list2 == null) {
            return list1 == null ? list2 : list1;
        }
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        while (list1 != null && list2 != null) {
            if (list1.val < list2.val) {
                cur.next = new ListNode(list1.val);
                cur = cur.next;
                list1 = list1.next;
            } else {
                cur.next = new ListNode(list2.val);
                cur = cur.next;
                list2 = list2.next;
            }
        }
        if (list1 != null) {
            cur.next = list1;
        } else {
            cur.next = list2;
        }
        return dummy.next;

    }
}

分治合并,将链表数组拆分成2段,处理好后合并。

class Solution {
    public ListNode mergeKLists(ListNode[] lists) {
        return merge(lists, 0, lists.length - 1);
    }

    private ListNode merge(ListNode[] lists, int l, int r) {

        if (l == r) {
            return lists[l];
        }
        if (l > r) {
            return null;
        }
        int mid = (l + r) / 2;
        return mergeTwoLists(merge(lists, l, mid), merge(lists, mid + 1, r));

    }

    public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
        if (list1 == null || list2 == null) {
            return list1 == null ? list2 : list1;
        }
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        while (list1 != null && list2 != null) {
            if (list1.val < list2.val) {
                cur.next = new ListNode(list1.val);
                cur = cur.next;
                list1 = list1.next;
            } else {
                cur.next = new ListNode(list2.val);
                cur = cur.next;
                list2 = list2.next;
            }
        }
        if (list1 != null) {
            cur.next = list1;
        } else {
            cur.next = list2;
        }
        return dummy.next;

    }
}

使用优先队列

class Solution {
    public ListNode mergeKLists(ListNode[] lists) {
        //优先队列默认是小顶堆,最小的元素放在队头,即a-b
        PriorityQueue<ListNode> priorityQueue = new PriorityQueue<ListNode>((a, b) -> {
            return a.val - b.val;
        });

        for (int i = 0; i < lists.length; i++) {
            if(lists[i]!=null){
priorityQueue.add(lists[i]);
            }
            
        }
        ListNode dummy = new ListNode(-1);
        ListNode cur = dummy;
        while (!priorityQueue.isEmpty()) {
            ListNode listNode = priorityQueue.poll();
            ListNode next = listNode.next;
            cur.next = listNode;
            cur = listNode;
            if (next != null) {
                priorityQueue.add(next);
            }
        }

        return dummy.next;

    }
}
LeetCode148: 排序链表

148. 排序链表

使用优先队列,最简单。

使用归并排序。做链表拆分。

可以和回文链表做比较,必须熟悉掌握两个链表合并的逻辑。

class Solution {
    public ListNode sortList(ListNode head) {
        if (head == null || head.next == null) {
            return head;
        }
        ListNode fast = head.next;
        ListNode slow = head;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
        }
        ListNode next = slow.next;
        slow.next = null;
        ListNode listNode1 = sortList(head);
        ListNode listNode2 = sortList(next);
        ListNode dummy = new ListNode(-1);
        ListNode cur =dummy;
        while (listNode1 != null && listNode2 != null) {
            if (listNode1.val < listNode2.val) {
                cur.next = listNode1;
                cur = cur.next;
                listNode1 = listNode1.next;
            } else {
                cur.next = listNode2;
                cur = cur.next;
                listNode2 = listNode2.next;
            }

        }
        cur.next = listNode1 == null ? listNode2 : listNode1;
        return dummy.next;
    }
}

LRU缓存

LeetCode146. LRU 缓存

146. LRU 缓存

使用LinkedHashMap,设置accessOrder为true,最近访问的元素会排在最后。而removeEldestEntry当条件满足的时候会移除最老的元素。

class LRUCache extends LinkedHashMap<Integer, Integer> {

    private int capacity;

    public LRUCache(int capacity) {
        super(capacity, 0.75f, true);
        this.capacity = capacity;
    }

    public int get(int key) {
        return super.getOrDefault(key, -1);
    }

    public void put(int key, int value) {
        super.put(key, value);
    }

    protected boolean removeEldestEntry(Map.Entry<Integer, Integer> entry) {
        return size() > this.capacity;
    }
}

使用Hash表和双向链表

双向链表记录访问顺序,Hash表获取元素

获取元素,将元素放在最前(移除当前元素在双向链表中的原位置,放在前面)。

存放元素,如果元素已存在,进行更新值,且将元素放在最前;如果元素不存在,添加元素要判断边界,超过边界要移除最早访问的元素(从链表和Hash表中移除)。

class LRUCache extends LinkedHashMap<Integer, Integer> {

    public class DLinkedNode {
        int key;
        int val;
        DLinkedNode prev;
        DLinkedNode next;

        public DLinkedNode() {
        }

        public DLinkedNode(int key, int val) {
            this.key = key;
            this.val = val;
        }
    }

    private Map<Integer, DLinkedNode> map = new HashMap<>();

    private int size;

    private int capacity;

    private DLinkedNode head, tail;


    public LRUCache(int capacity) {
        this.capacity = capacity;
        size = 0;
        head = new DLinkedNode();
        tail = new DLinkedNode();
        head.next = tail;
        tail.prev = head;
    }

    public int get(int key) {
        DLinkedNode dLinkedNode = map.get(key);
        if (dLinkedNode == null) {
            return -1;
        } else {
            moveToHead(dLinkedNode);
            return dLinkedNode.val;
        }
    }

    private void moveToHead(DLinkedNode node) {
        removeNode(node);
        addToHead(node);

    }

    private void addToHead(DLinkedNode node) {
        DLinkedNode next = head.next;
        head.next = node;
        node.prev = head;
        node.next = next;
        next.prev = node;
    }

    private void removeNode(DLinkedNode node) {
        DLinkedNode prev = node.prev;
        DLinkedNode next = node.next;
        prev.next = next;
        next.prev = prev;
    }

    private DLinkedNode removeTail() {
        DLinkedNode prev = tail.prev;
        removeNode(prev);
        return prev;
    }

    public void put(int key, int value) {
        DLinkedNode node = map.get(key);
        if (node == null) {
            DLinkedNode newNode = new DLinkedNode(key, value);

            map.put(key, newNode);
            addToHead(newNode);
            size++;
            if (size > capacity) {
                DLinkedNode tail = removeTail();
                map.remove(tail.key);
                size--;
            }
        } else {

            node.val = value;
            moveToHead(node);
        }
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/283522.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

uniapp中的uview组件库丰富的Form 表单用法

目录 基本使用 #Form-item组件说明 #验证规则 #验证规则属性 #uView自带验证规则 #综合实战 #校验错误提示方式 #校验 基本使用 此组件一般是用于表单验证使用&#xff0c;每一个表单域由一个u-form-item组成&#xff0c;表单域中可以放置u-input、u-checkbox、u-radio…

Javaweb之Mybatis入门程序的详细解析

1.2 入门程序实现 1.2.1 准备工作 1.2.1.1 创建springboot工程 创建springboot工程&#xff0c;并导入 mybatis的起步依赖、mysql的驱动包。 项目工程创建完成后&#xff0c;自动在pom.xml文件中&#xff0c;导入Mybatis依赖和MySQL驱动依赖 <!-- 仅供参考&#xff1a;只…

初始Web服务器

一、web服务器 1、什么是web服务器&#xff1f; web服务器就是web项目的容器&#xff0c;我们将开发好的web项目部署到web容器中&#xff0c;才能使用网络中的用户通过浏览器进行访问。 一张图带你了解web服务器有啥作用&#xff1a; 在我的电脑上有一个已经做好的项目&#…

Openwrt修改Dropbear ssh root密码

使用ssh工具连接路由器 输入&#xff1a;passwd root 输入新密码 重复新密码 设置完成 rootImmortalWrt:~# passwd root Changing password for root New password:

2023年总结(2023年1月1日至2023年12月31日)

前言 时间过得真快啊&#xff0c;一年又过去了。 从去年11月换了家公司后&#xff0c;工作就稳定多了&#xff0c;做的工作也是我喜欢做的工作——摄像头驱动&#xff0c;平时也挺轻松的&#xff0c;偶尔有事儿的时候会压力大点&#xff0c;加点班&#xff0c;其他都还好&…

《2023年企业IoT和OT威胁报告》:物联网恶意软件攻击增长400%

内容概括&#xff1a; 物联网&#xff08;IoT&#xff09;设备无疑改变了我们生活、工作和管理运营技术&#xff08;OT&#xff09;环境的方式。总体而言&#xff0c;到2027年&#xff0c;全球物联网设备数量预计将超过290亿&#xff0c;比2023年的167亿大幅增加。设备和智能技…

伺服电机为什么叫伺服电机,内部结构是什么,工作原理是什么,有什么特点。

问题描述&#xff1a;伺服电机为什么叫伺服电机&#xff0c;内部结构是什么&#xff0c;工作原理是什么&#xff0c;有什么特点。 问题解答&#xff1a; 名字是拉丁语音译过来的&#xff0c;直译的话就叫奴仆电机。 "伺服"一词源于拉丁语 "servus"&#…

面试手撕算法高频专题:数组的双指针思想及应用(算法村第三关白银挑战)

所谓的双指针其实就是两个变量&#xff0c;不一定真的是指针。 快慢指针&#xff1a;一起向前走对撞指针、相向指针&#xff1a;从两头向中间走背向指针&#xff1a;从中间向两头走 移除值为val的元素 题目描述 27. 移除元素 - 力扣&#xff08;LeetCode&#xff09; 给你…

【C#】知识点实践序列之Lock的输出多线程信息

大家好&#xff0c;我是全栈小5&#xff0c;欢迎来到《小5讲堂之知识点实践序列》文章。 2023年第2篇文章&#xff0c;此篇文章是C#知识点实践序列之Lock知识点&#xff0c;博主能力有限&#xff0c;理解水平有限&#xff0c;若有不对之处望指正&#xff01; 本篇在Lock锁定代码…

开关电源反馈环路重要参数设计,PC817和TL431实例计算和取值详解

author&#xff1a;小高霸气 data:2021.04.16 下面介绍开关电源重要的反馈电路PC817和TL431设计和应用。 在开关电源当中&#xff0c;对稳压反馈电路的设计通常会使用TL431和PC817来配合使用。在TOP 及3842等单端反激电路中的反馈电路很多都采用TL431和PC817作为参考、隔离、取…

Vue中目录以及文件内容简单分析

src文件下目录分析&#xff1a; App.vue文件中内容&#xff1a; vue文件中基本的三个结构&#xff0c;template&#xff08;结构&#xff09;、script&#xff08;行为&#xff09; 、style&#xff08;样式&#xff09;。 <template><!-- html结构 --><div cl…

记一次Oracle Cloud计算实例ssh恢复过程

#ssh秘钥丢失# &#xff0c; #Oracle Cloud# 。 电脑上的ssh秘钥文件不知道什么时候丢失了&#xff0c;直到用的时候才发现没有了&#xff0c;这下可好&#xff0c;Oracle Cloud的计算实例连不上了&#xff0c;这个实例只能通过ssh连接上去&#xff1a; 以下是解决步骤&#x…

Linux常用命令大全总结及讲解(超详细版)

前言&#xff1a; Linux 是一个基于Linux 内核的开源类Unix 操作系统&#xff0c;Linus Torvalds于 1991 年 9 月 17 日首次发布的操作系统内核。Linux 通常打包为Linux 发行版。 Linux 最初是为基于Intel x86架构的个人计算机开发的&#xff0c;但此后被移植到的平台比任何其…

Ubuntu系统上TensorBoard使用方式

Ubuntu系统上TensorBoard使用方式 Tensorboard 启动TensorBoard 后台开启TensorBoard访问权限 执行命令&#xff1a;nohup tensorboard --logdirlogs/ >>tensorboard.log & 查看访问链接和登录token 执行命令&#xff1a;cat tensorboard.log&#xff0c;打开ten…

typore自定义删除线快捷键

打开高级设置 设置快捷键 重新打开typore

在高并发场景下,缓存“雪崩”了怎么办

1. 缓存雪崩的常见原因 缓存“雪崩”是指&#xff0c;因为部分缓存节点不可用&#xff0c;而导致整个缓存系统&#xff08;甚至是整个服务系统&#xff09;不可用。缓存“雪崩”主要分为以下两种情况&#xff1a; 因缓存不支持 rehash 而导致的缓存“雪崩”缓存支持 rehash 时…

【Java】ThreadLocal原理与使用场景

ThreadLocal原理&#xff1a; 字段&#xff1a; //ThreadLocal对象的哈希码 private final int threadLocalHashCode nextHashCode();//生成ThreadLocal对象的哈希码时&#xff0c;需要用到该对象&#xff0c;从0开始 private static AtomicInteger nextHashCode new Atomic…

使用docker build构建image

文章目录 环境步骤准备例1&#xff1a;基本用法例2&#xff1a;缓存layer例3&#xff1a;Multi-stage例4&#xff1a;Mountcache mountbind mount 例5&#xff1a;参数例6&#xff1a;Export文件例7&#xff1a;测试 参考 环境 RHEL 9.3Docker Community 24.0.7 步骤 在Dock…

Pix2Pix如何工作?

一、说明 在本指南中&#xff0c;我们将重点介绍 Pix2Pix [1]&#xff0c;它是用于配对图像翻译的著名且成功的深度学习模型之一。在地理空间科学中&#xff0c;这种方法可以帮助传统上不可能的广泛应用&#xff0c;在这些应用中&#xff0c;我们可能希望从一个图像域转到另一个…

认识Linux基本指令之 “touch mkdir rm”

01.touch指令 语法:touch [选项]... 文件... 功能&#xff1a;touch命令参数可更改文档或目录的日期时间&#xff0c;包括存取时间和更改时间&#xff0c;或者新建一个不存在的文件 常用选项&#xff1a; -a 或--timeatime或--timeaccess或--timeuse只更改存取时间。 -c…
最新文章