当前位置: 首页 > news >正文

算法-3-基本的数据结构

单双链表

1.单链表双链表如何反转

import java.util.ArrayList;
import java.util.List;public class Code01_ReverseList {public static class Node {public int value;public Node next;public Node(int data) {value = data;}}public static class DoubleNode {public int value;public DoubleNode last;public DoubleNode next;public DoubleNode(int data) {value = data;}}//  head//   a    ->   b    ->  c  ->  null//   c    ->   b    ->  a  ->  nullpublic static Node reverseLinkedList(Node head) {Node pre = null;Node next = null;while (head != null) {next = head.next;head.next = pre;pre = head;head = next;}return pre;}public static DoubleNode reverseDoubleList(DoubleNode head) {DoubleNode pre = null;DoubleNode next = null;while (head != null) {next = head.next;head.next = pre;head.last = next;pre = head;head = next;}return pre;}public static Node testReverseLinkedList(Node head) {if (head == null) {return null;}ArrayList<Node> list = new ArrayList<>();while (head != null) {list.add(head);head = head.next;}list.get(0).next = null;int N = list.size();for (int i = 1; i < N; i++) {list.get(i).next = list.get(i - 1);}return list.get(N - 1);}public static DoubleNode testReverseDoubleList(DoubleNode head) {if (head == null) {return null;}ArrayList<DoubleNode> list = new ArrayList<>();while (head != null) {list.add(head);head = head.next;}list.get(0).next = null;DoubleNode pre = list.get(0);int N = list.size();for (int i = 1; i < N; i++) {DoubleNode cur = list.get(i);cur.last = null;cur.next = pre;pre.last = cur;pre = cur;}return list.get(N - 1);}// for testpublic static Node generateRandomLinkedList(int len, int value) {int size = (int) (Math.random() * (len + 1));if (size == 0) {return null;}size--;Node head = new Node((int) (Math.random() * (value + 1)));Node pre = head;while (size != 0) {Node cur = new Node((int) (Math.random() * (value + 1)));pre.next = cur;pre = cur;size--;}return head;}// for testpublic static DoubleNode generateRandomDoubleList(int len, int value) {int size = (int) (Math.random() * (len + 1));if (size == 0) {return null;}size--;DoubleNode head = new DoubleNode((int) (Math.random() * (value + 1)));DoubleNode pre = head;while (size != 0) {DoubleNode cur = new DoubleNode((int) (Math.random() * (value + 1)));pre.next = cur;cur.last = pre;pre = cur;size--;}return head;}// for testpublic static List<Integer> getLinkedListOriginOrder(Node head) {List<Integer> ans = new ArrayList<>();while (head != null) {ans.add(head.value);head = head.next;}return ans;}// for testpublic static boolean checkLinkedListReverse(List<Integer> origin, Node head) {for (int i = origin.size() - 1; i >= 0; i--) {if (!origin.get(i).equals(head.value)) {return false;}head = head.next;}return true;}// for testpublic static List<Integer> getDoubleListOriginOrder(DoubleNode head) {List<Integer> ans = new ArrayList<>();while (head != null) {ans.add(head.value);head = head.next;}return ans;}// for testpublic static boolean checkDoubleListReverse(List<Integer> origin, DoubleNode head) {DoubleNode end = null;for (int i = origin.size() - 1; i >= 0; i--) {if (!origin.get(i).equals(head.value)) {return false;}end = head;head = head.next;}for (int i = 0; i < origin.size(); i++) {if (!origin.get(i).equals(end.value)) {return false;}end = end.last;}return true;}// for testpublic static void main(String[] args) {int len = 50;int value = 100;int testTime = 100000;System.out.println("test begin!");for (int i = 0; i < testTime; i++) {Node node1 = generateRandomLinkedList(len, value);List<Integer> list1 = getLinkedListOriginOrder(node1);node1 = reverseLinkedList(node1);if (!checkLinkedListReverse(list1, node1)) {System.out.println("Oops1!");}Node node2 = generateRandomLinkedList(len, value);List<Integer> list2 = getLinkedListOriginOrder(node2);node2 = testReverseLinkedList(node2);if (!checkLinkedListReverse(list2, node2)) {System.out.println("Oops2!");}DoubleNode node3 = generateRandomDoubleList(len, value);List<Integer> list3 = getDoubleListOriginOrder(node3);node3 = reverseDoubleList(node3);if (!checkDoubleListReverse(list3, node3)) {System.out.println("Oops3!");}DoubleNode node4 = generateRandomDoubleList(len, value);List<Integer> list4 = getDoubleListOriginOrder(node4);node4 = reverseDoubleList(node4);if (!checkDoubleListReverse(list4, node4)) {System.out.println("Oops4!");}}System.out.println("test finish!");}}

2.把定值都删除掉

是n就跳过,不是n next指向

public class Code02_DeleteGivenValue {public static class Node {public int value;public Node next;public Node(int data) {this.value = data;}}// head = removeValue(head, 2);public static Node removeValue(Node head, int num) {// head来到第一个不需要删的位置while (head != null) {if (head.value != num) {break;}head = head.next;}// 1 ) head == null// 2 ) head != nullNode pre = head;Node cur = head;while (cur != null) {if (cur.value == num) {pre.next = cur.next;} else {pre = cur;}cur = cur.next;}return head;}}

队列跟栈

双链表实现

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;public class Code03_DoubleEndsQueueToStackAndQueue {public static class Node<T> {public T value;public Node<T> last;public Node<T> next;public Node(T data) {value = data;}}public static class DoubleEndsQueue<T> {public Node<T> head;public Node<T> tail;public void addFromHead(T value) {Node<T> cur = new Node<T>(value);if (head == null) {head = cur;tail = cur;} else {cur.next = head;head.last = cur;head = cur;}}public void addFromBottom(T value) {Node<T> cur = new Node<T>(value);if (head == null) {head = cur;tail = cur;} else {cur.last = tail;tail.next = cur;tail = cur;}}public T popFromHead() {if (head == null) {return null;}Node<T> cur = head;if (head == tail) {head = null;tail = null;} else {head = head.next;cur.next = null;head.last = null;}return cur.value;}public T popFromBottom() {if (head == null) {return null;}Node<T> cur = tail;if (head == tail) {head = null;tail = null;} else {tail = tail.last;tail.next = null;cur.last = null;}return cur.value;}public boolean isEmpty() {return head == null;}}public static class MyStack<T> {private DoubleEndsQueue<T> queue;public MyStack() {queue = new DoubleEndsQueue<T>();}public void push(T value) {queue.addFromHead(value);}public T pop() {return queue.popFromHead();}public boolean isEmpty() {return queue.isEmpty();}}public static class MyQueue<T> {private DoubleEndsQueue<T> queue;public MyQueue() {queue = new DoubleEndsQueue<T>();}public void push(T value) {queue.addFromHead(value);}public T poll() {return queue.popFromBottom();}public boolean isEmpty() {return queue.isEmpty();}}public static boolean isEqual(Integer o1, Integer o2) {if (o1 == null && o2 != null) {return false;}if (o1 != null && o2 == null) {return false;}if (o1 == null && o2 == null) {return true;}return o1.equals(o2);}public static void main(String[] args) {int oneTestDataNum = 100;int value = 10000;int testTimes = 100000;for (int i = 0; i < testTimes; i++) {MyStack<Integer> myStack = new MyStack<>();MyQueue<Integer> myQueue = new MyQueue<>();Stack<Integer> stack = new Stack<>();Queue<Integer> queue = new LinkedList<>();for (int j = 0; j < oneTestDataNum; j++) {int nums = (int) (Math.random() * value);if (stack.isEmpty()) {myStack.push(nums);stack.push(nums);} else {if (Math.random() < 0.5) {myStack.push(nums);stack.push(nums);} else {if (!isEqual(myStack.pop(), stack.pop())) {System.out.println("oops!");}}}int numq = (int) (Math.random() * value);if (stack.isEmpty()) {myQueue.push(numq);queue.offer(numq);} else {if (Math.random() < 0.5) {myQueue.push(numq);queue.offer(numq);} else {if (!isEqual(myQueue.poll(), queue.poll())) {System.out.println("oops!");}}}}}System.out.println("finish!");}}

数组实现

public class Code04_RingArray {public static class MyQueue {private int[] arr;private int pushi;// endprivate int polli;// beginprivate int size;private final int limit;public MyQueue(int limit) {arr = new int[limit];pushi = 0;polli = 0;size = 0;this.limit = limit;}public void push(int value) {if (size == limit) {throw new RuntimeException("队列满了,不能再加了");}size++;arr[pushi] = value;pushi = nextIndex(pushi);}public int pop() {if (size == 0) {throw new RuntimeException("队列空了,不能再拿了");}size--;int ans = arr[polli];polli = nextIndex(polli);return ans;}public boolean isEmpty() {return size == 0;}// 如果现在的下标是i,返回下一个位置private int nextIndex(int i) {return i < limit - 1 ? i + 1 : 0;}}}

实现一个特殊的栈,在基本功能基础上,再实现返回栈中最小元素的功能

1.pop,push,getMin,操作的时间复杂度都是O(1)

2.设计的栈类型可以使用现成的栈结构

同步压入,同步弹出

import java.util.Stack;public class Code05_GetMinStack {public static class MyStack1 {private Stack<Integer> stackData;private Stack<Integer> stackMin;public MyStack1() {this.stackData = new Stack<Integer>();this.stackMin = new Stack<Integer>();}public void push(int newNum) {if (this.stackMin.isEmpty()) {this.stackMin.push(newNum);} else if (newNum <= this.getmin()) {this.stackMin.push(newNum);}this.stackData.push(newNum);}public int pop() {if (this.stackData.isEmpty()) {throw new RuntimeException("Your stack is empty.");}int value = this.stackData.pop();if (value == this.getmin()) {this.stackMin.pop();}return value;}public int getmin() {if (this.stackMin.isEmpty()) {throw new RuntimeException("Your stack is empty.");}return this.stackMin.peek();}}public static class MyStack2 {private Stack<Integer> stackData;private Stack<Integer> stackMin;public MyStack2() {this.stackData = new Stack<Integer>();this.stackMin = new Stack<Integer>();}public void push(int newNum) {if (this.stackMin.isEmpty()) {this.stackMin.push(newNum);} else if (newNum < this.getmin()) {this.stackMin.push(newNum);} else {int newMin = this.stackMin.peek();this.stackMin.push(newMin);}this.stackData.push(newNum);}public int pop() {if (this.stackData.isEmpty()) {throw new RuntimeException("Your stack is empty.");}this.stackMin.pop();return this.stackData.pop();}public int getmin() {if (this.stackMin.isEmpty()) {throw new RuntimeException("Your stack is empty.");}return this.stackMin.peek();}}public static void main(String[] args) {MyStack1 stack1 = new MyStack1();stack1.push(3);System.out.println(stack1.getmin());stack1.push(4);System.out.println(stack1.getmin());stack1.push(1);System.out.println(stack1.getmin());System.out.println(stack1.pop());System.out.println(stack1.getmin());System.out.println("=============");MyStack1 stack2 = new MyStack1();stack2.push(3);System.out.println(stack2.getmin());stack2.push(4);System.out.println(stack2.getmin());stack2.push(1);System.out.println(stack2.getmin());System.out.println(stack2.pop());System.out.println(stack2.getmin());}}

如何使用栈结构实现队列结构

import java.util.Stack;public class Code06_TwoStacksImplementQueue {public static class TwoStacksQueue {public Stack<Integer> stackPush;public Stack<Integer> stackPop;public TwoStacksQueue() {stackPush = new Stack<Integer>();stackPop = new Stack<Integer>();}// push栈向pop栈倒入数据private void pushToPop() {if (stackPop.empty()) {while (!stackPush.empty()) {stackPop.push(stackPush.pop());}}}public void add(int pushInt) {stackPush.push(pushInt);pushToPop();}public int poll() {if (stackPop.empty() && stackPush.empty()) {throw new RuntimeException("Queue is empty!");}pushToPop();return stackPop.pop();}public int peek() {if (stackPop.empty() && stackPush.empty()) {throw new RuntimeException("Queue is empty!");}pushToPop();return stackPop.peek();}}public static void main(String[] args) {TwoStacksQueue test = new TwoStacksQueue();test.add(1);test.add(2);test.add(3);System.out.println(test.peek());System.out.println(test.poll());System.out.println(test.peek());System.out.println(test.poll());System.out.println(test.peek());System.out.println(test.poll());}}

如何使用队列结构实现栈结构

import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;public class Code07_TwoQueueImplementStack {public static class TwoQueueStack<T> {public Queue<T> queue;public Queue<T> help;public TwoQueueStack() {queue = new LinkedList<>();help = new LinkedList<>();}public void push(T value) {queue.offer(value);}public T poll() {while (queue.size() > 1) {help.offer(queue.poll());}T ans = queue.poll();Queue<T> tmp = queue;queue = help;help = tmp;return ans;}public T peek() {while (queue.size() > 1) {help.offer(queue.poll());}T ans = queue.poll();help.offer(ans);Queue<T> tmp = queue;queue = help;help = tmp;return ans;}public boolean isEmpty() {return queue.isEmpty();}}public static void main(String[] args) {System.out.println("test begin");TwoQueueStack<Integer> myStack = new TwoQueueStack<>();Stack<Integer> test = new Stack<>();int testTime = 1000000;int max = 1000000;for (int i = 0; i < testTime; i++) {if (myStack.isEmpty()) {if (!test.isEmpty()) {System.out.println("Oops");}int num = (int) (Math.random() * max);myStack.push(num);test.push(num);} else {if (Math.random() < 0.25) {int num = (int) (Math.random() * max);myStack.push(num);test.push(num);} else if (Math.random() < 0.5) {if (!myStack.peek().equals(test.peek())) {System.out.println("Oops");}} else if (Math.random() < 0.75) {if (!myStack.poll().equals(test.pop())) {System.out.println("Oops");}} else {if (myStack.isEmpty() != test.isEmpty()) {System.out.println("Oops");}}}}System.out.println("test finish!");}}

Master 公式求递推的时间复杂度

前提,子问题规模一致,(比如,子问题是分两个二分之N区间分别求最大值,可以Master,若分为三分之N那就不行)

公式:T(N)=a*T(N/b)+O(N的d次方)

得到abd之后

求最大值

public class Code08_GetMax {// 求arr中的最大值public static int getMax(int[] arr) {return process(arr, 0, arr.length - 1);}// arr[L..R]范围上求最大值  L ... R   Npublic static int process(int[] arr, int L, int R) {// arr[L..R]范围上只有一个数,直接返回,base caseif (L == R) { return arr[L];}// L...R 不只一个数// mid = (L + R) / 2int mid = L + ((R - L) >> 1); // 中点   	1int leftMax = process(arr, L, mid);int rightMax = process(arr, mid + 1, R);return Math.max(leftMax, rightMax);}}

哈希

import java.util.HashMap;
import java.util.HashSet;
import java.util.TreeMap;public class HashMapAndSortedMap {public static class Node {public int value;public Node(int v) {value = v;}}public static class Zuo {public int value;public Zuo(int v) {value = v;}}public static void main(String[] args) {HashMap<Integer, String> test = new HashMap<>();Integer a = 19000000;Integer b = 19000000;System.out.println(a == b);test.put(a, "我是3");System.out.println(test.containsKey(b));Zuo z1 = new Zuo(1);Zuo z2 = new Zuo(1);HashMap<Zuo, String> test2 = new HashMap<>();test2.put(z1, "我是z1");System.out.println(test2.containsKey(z2));// UnSortedMapHashMap<Integer, String> map = new HashMap<>();map.put(1000000, "我是1000000");map.put(2, "我是2");map.put(3, "我是3");map.put(4, "我是4");map.put(5, "我是5");map.put(6, "我是6");map.put(1000000, "我是1000001");System.out.println(map.containsKey(1));System.out.println(map.containsKey(10));System.out.println(map.get(4));System.out.println(map.get(10));map.put(4, "他是4");System.out.println(map.get(4));map.remove(4);System.out.println(map.get(4));// keyHashSet<String> set = new HashSet<>();set.add("abc");set.contains("abc");set.remove("abc");// 哈希表,增、删、改、查,在使用时,O(1)System.out.println("=====================");Integer c = 100000;Integer d = 100000;System.out.println(c.equals(d));Integer e = 127; // - 128 ~ 127Integer f = 127;System.out.println(e == f);HashMap<Node, String> map2 = new HashMap<>();Node node1 = new Node(1);Node node2 = node1;map2.put(node1, "我是node1");map2.put(node2, "我是node1");System.out.println(map2.size());System.out.println("======================");// TreeMap 有序表:接口名// 红黑树、avl、sb树、跳表// O(logN)System.out.println("有序表测试开始");TreeMap<Integer, String> treeMap = new TreeMap<>();treeMap.put(3, "我是3");treeMap.put(4, "我是4");treeMap.put(8, "我是8");treeMap.put(5, "我是5");treeMap.put(7, "我是7");treeMap.put(1, "我是1");treeMap.put(2, "我是2");System.out.println(treeMap.containsKey(1));System.out.println(treeMap.containsKey(10));System.out.println(treeMap.get(4));System.out.println(treeMap.get(10));treeMap.put(4, "他是4");System.out.println(treeMap.get(4));// treeMap.remove(4);System.out.println(treeMap.get(4));System.out.println("新鲜:");System.out.println(treeMap.firstKey());System.out.println(treeMap.lastKey());// <= 4System.out.println(treeMap.floorKey(4));// >= 4System.out.println(treeMap.ceilingKey(4));// O(logN)}}

 

相关文章:

算法-3-基本的数据结构

单双链表 1.单链表双链表如何反转 import java.util.ArrayList; import java.util.List;public class Code01_ReverseList {public static class Node {public int value;public Node next;public Node(int data) {value data;}}public static class DoubleNode {public int…...

探秘Java反射:灵活编程的利器

前言 大家好&#xff0c;我是chowley&#xff0c;不知道大家在学习Java的过程中有没有听过反射的概念&#xff0c;今天我来总结一下我心中的Java反射。 在Java编程中&#xff0c;反射是一种强大的工具&#xff0c;它允许程序在运行时检查和操作类、方法、属性等&#xff0c;而…...

记录 | ubuntu pyqt5 pycharm配置

Ubuntu16.04pycharmpyqt5安装与配置_ubuntu pycharm pyqt5-CSDN博客pycharm激活码 6ZUMD7WWWU-eyJsaWNlbnNlSWQiOiI2WlVNRDdXV1dVIiwibGljZW5zZWVOYW1lIjoiSmV0cyBHcm91cCIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiIiLCJjaGVja0NvbmN…...

ESP32学习(1)——环境搭建

使用的ESP32板子如下图所示 它可以用Arduino 软件&#xff0c;基于C语言开发。但是&#xff0c;在这里&#xff0c;我是用Thonny软件&#xff0c;基于micro_python对其进行开发。 1.安装Thonny Thonny的软件安装包&#xff0c;可以去它官网上下载。Thonny, Python IDE for begi…...

Attention Is All Your Need论文笔记

论文解决了什么问题&#xff1f; 提出了一个新的简单网络架构——transformer&#xff0c;仅仅是基于注意力机制&#xff0c;完全免去递推和卷积&#xff0c;使得神经网络训练地速度极大地提高。 We propose a new simple network architecture, the Transformer, based sole…...

vue-进阶语法(四)

目录 v-model原理 v-model应用于组件 sync修饰符 ref 和 $refs&#xff08;重点&#xff09; $nextTick v-model原理 原理&#xff1a;v-model本质上是一个语法糖。例如应用在输入框上&#xff0c;就是 value属性 和 input事件 的合写。 作用&#xff1a;提供数据的双向…...

CGAL::2D Arrangements-7

7 几何Traits 几何Traits封装了几何实体的定义以及处理这些几何实体的几何predicates和构造的实现&#xff0c;供Arrangement_on_surface_2类模板和其他周边模块使用。应用于Arrangement的各种算法所确定的最小要求被组织在精细几何特征概念的层次中。每个概念列出的需求只包括…...

linux系统下vscode portable版本的rust环境搭建004:rust

目的&#xff1a;希望在获得一个新的系统之后&#xff0c;以最简便快速的方式搭配一个rust的编程环境命令在线安装只执行这句就行了 &#xff1a;curl --proto https --tlsv1.2 -sSf https://sh.rustup.rs | sh&#xff0c;因为是要portable安装所以按照以下的方式执行。 下载…...

从汇编角度解释线程间互斥-mutex互斥锁与lock_guard的使用

多线程并发的竞态问题 我们创建三个线程同时进行购票&#xff0c;代码如下 #include<iostream> #include<thread> #include<list> using namespace std; //总票数 int ticketCount100; //售票线程 void sellTicket(int idx) {while(ticketCount>0){cou…...

高程 | 多态性(c++)

文章目录 &#x1f4da;多态&#x1f4da;运算符重载&#x1f407;定义&#x1f407;规则&#x1f407;友元运算符重载函数&#x1f407;成员运算符重载函数 &#x1f4da;虚函数&#x1f4da;纯虚函数和抽象类 &#x1f4da;多态 多态&#xff1a;同样的消息被不同类型的对象…...

LV.23 D2 开发环境搭建及平台介绍 学习笔记

一、Keil MDK-ARM简介及安装 Keil MDK&#xff0c;也称MDK-ARM&#xff0c;Realview MDK &#xff08;Microcontroller Development Kit&#xff09;等。目前Keil MDK 由三家国内代理商提供技术支持和相关服务。 MDK-ARM软件为基于Cortex-M、Cortex-R4、ARM7、ARM9处理器设备…...

[uniapp生命周期]详细讲解uniapp中那些属于vue生命周期,那些属于uniapp独有的生命周期,以及这中间的区别 相关的内容和api 代码注释

目录 1. Vue.js生命周期函数2.Vue生命周期函数代码beforeCreatecreatedbeforeMountmountedbeforeUpdateupdatedbeforeDestroydestroyed$nextTick$forceUpdate$destroy 3. UniApp独有的生命周期函数onLaunchonShowonHideonError 4.总结 在UniApp中&#xff0c;除了Vue.js的生命周…...

【动态规划】【记忆化搜索】【状态压缩】1681. 最小不兼容性

作者推荐 【数位dp】【动态规划】【状态压缩】【推荐】1012. 至少有 1 位重复的数字 本文涉及知识点 动态规划汇总 状态压缩 记忆化搜索 1681. 最小不兼容性 给你一个整数数组 nums​​​ 和一个整数 k 。你需要将这个数组划分到 k 个相同大小的子集中&#xff0c;使得同一…...

JVM-类加载器 双亲委派机制

申明&#xff1a;文章内容是本人学习极客时间课程所写&#xff0c;文字和图片基本来源于课程资料&#xff0c;在某些地方会插入一点自己的理解&#xff0c;未用于商业用途&#xff0c;侵删。 什么是JVM JVM是Java Virtual Machine&#xff08;Java虚拟机&#xff09;的缩写&a…...

vue axios 请求后端无法传参问题

vue请求后端无法传参问题 问题描述处理过程总结 问题描述 在学习vue时&#xff0c;使用axios调用后端&#xff0c;发现无法把参数正确传到后端&#xff0c;现象如下&#xff1a; 使用vue发起请求&#xff0c;浏览器上已经有传参&#xff0c;但是后端没接收到对应的用户名密码&…...

打印最小公倍数

打印最小公倍数 题目描述&#xff1a; 输入2个整数m和n&#xff0c;计算m和n的最小公倍数&#xff0c;并打印出结果 测试1&#xff1a; 输入&#xff1a;18 24 输出&#xff1a;72 测试2&#xff1a; 输入&#xff1a;18 6 输出&#xff1a;18解法思路: 最小公倍数是指两个…...

[AIGC] Java 和 Kotlin 的区别

好的&#xff0c;我还是以“萌萌哒小码农”的身份继续回答您的问题。 Java 和 Kotlin 是两种不同的编程语言&#xff0c;它们有许多共同点&#xff0c;但也有一些重要的区别。以下是一些常见的 Java 和 Kotlin 的区别&#xff1a; 语法 Kotlin 的语法比 Java 简洁得多&#…...

蓝桥杯电子类单片机提升一——超声波测距

前言 单片机资源数据包_2023 一、超声波测距原理 二、超声波测距的应用 1.超声波的发射 2.单片机知识补充&#xff1a;定时器 3.超声波的接收与计时 4.距离的计算 1&#xff09;定时器1为16位自动重载&#xff0b;1T11.0592MHz 2&#xff09;定时器1为16位自动重载&am…...

前端架构: 脚手架开发流程中的难点梳理

脚手架的开发流程 1 &#xff09;开发流程 创建 npm 项目创建脚手架入口文件&#xff0c;最上方添加&#xff1a; #!/usr/bin/env node 配置 package.json, 添加 bin 属性编写脚手架代码将脚手架发布到 npm 2 &#xff09;使用流程 安装脚手架 npm install -g your-own-cli …...

django中配置使用websocket

Django 默认情况下并不支持 WebSocket&#xff0c;但你可以通过集成第三方库如 channels 来实现 WebSocket 功能。channels 是一个 Django 应用&#xff0c;它提供了对 WebSocket、HTTP2 和其他协议的支持。 下面是如何在 Django 项目中使用 WebSocket 的基本步骤&#xff1a;…...

测试markdown--肇兴

day1&#xff1a; 1、去程&#xff1a;7:04 --11:32高铁 高铁右转上售票大厅2楼&#xff0c;穿过候车厅下一楼&#xff0c;上大巴车 &#xffe5;10/人 **2、到达&#xff1a;**12点多到达寨子&#xff0c;买门票&#xff0c;美团/抖音&#xff1a;&#xffe5;78人 3、中饭&a…...

【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】

1. BluetoothProperties介绍 libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop BluetoothProperties.sysprop 是 Android AOSP 中的一种 系统属性定义文件&#xff08;System Property Definition File&#xff09;&#xff0c;用于声明和管理 Bluetooth 模块相…...

css3笔记 (1) 自用

outline: none 用于移除元素获得焦点时默认的轮廓线 broder:0 用于移除边框 font-size&#xff1a;0 用于设置字体不显示 list-style: none 消除<li> 标签默认样式 margin: xx auto 版心居中 width:100% 通栏 vertical-align 作用于行内元素 / 表格单元格&#xff…...

DeepSeek 技术赋能无人农场协同作业:用 AI 重构农田管理 “神经网”

目录 一、引言二、DeepSeek 技术大揭秘2.1 核心架构解析2.2 关键技术剖析 三、智能农业无人农场协同作业现状3.1 发展现状概述3.2 协同作业模式介绍 四、DeepSeek 的 “农场奇妙游”4.1 数据处理与分析4.2 作物生长监测与预测4.3 病虫害防治4.4 农机协同作业调度 五、实际案例大…...

算法岗面试经验分享-大模型篇

文章目录 A 基础语言模型A.1 TransformerA.2 Bert B 大语言模型结构B.1 GPTB.2 LLamaB.3 ChatGLMB.4 Qwen C 大语言模型微调C.1 Fine-tuningC.2 Adapter-tuningC.3 Prefix-tuningC.4 P-tuningC.5 LoRA A 基础语言模型 A.1 Transformer &#xff08;1&#xff09;资源 论文&a…...

【笔记】WSL 中 Rust 安装与测试完整记录

#工作记录 WSL 中 Rust 安装与测试完整记录 1. 运行环境 系统&#xff1a;Ubuntu 24.04 LTS (WSL2)架构&#xff1a;x86_64 (GNU/Linux)Rust 版本&#xff1a;rustc 1.87.0 (2025-05-09)Cargo 版本&#xff1a;cargo 1.87.0 (2025-05-06) 2. 安装 Rust 2.1 使用 Rust 官方安…...

Web中间件--tomcat学习

Web中间件–tomcat Java虚拟机详解 什么是JAVA虚拟机 Java虚拟机是一个抽象的计算机&#xff0c;它可以执行Java字节码。Java虚拟机是Java平台的一部分&#xff0c;Java平台由Java语言、Java API和Java虚拟机组成。Java虚拟机的主要作用是将Java字节码转换为机器代码&#x…...

windows系统MySQL安装文档

概览&#xff1a;本文讨论了MySQL的安装、使用过程中涉及的解压、配置、初始化、注册服务、启动、修改密码、登录、退出以及卸载等相关内容&#xff0c;为学习者提供全面的操作指导。关键要点包括&#xff1a; 解压 &#xff1a;下载完成后解压压缩包&#xff0c;得到MySQL 8.…...

9-Oracle 23 ai Vector Search 特性 知识准备

很多小伙伴是不是参加了 免费认证课程&#xff08;限时至2025/5/15&#xff09; Oracle AI Vector Search 1Z0-184-25考试&#xff0c;都顺利拿到certified了没。 各行各业的AI 大模型的到来&#xff0c;传统的数据库中的SQL还能不能打&#xff0c;结构化和非结构的话数据如何和…...

SQL Server 触发器调用存储过程实现发送 HTTP 请求

文章目录 需求分析解决第 1 步:前置条件,启用 OLE 自动化方式 1:使用 SQL 实现启用 OLE 自动化方式 2:Sql Server 2005启动OLE自动化方式 3:Sql Server 2008启动OLE自动化第 2 步:创建存储过程第 3 步:创建触发器扩展 - 如何调试?第 1 步:登录 SQL Server 2008第 2 步…...