树的基本操作
摘要:class TreeNode { val: number left: TreeNode | null right: TreeNode | null constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {
阅读全文
链表的基本操作
摘要:class ListNode { val: number next: ListNode | null constructor(val?: number, next?: ListNode | null) { this.val = (val undefined ? 0 : val) this.next
阅读全文
第二章、数据结构与算法
摘要:####十一、算法-排序和搜索 #####1、排序和搜索简介 /** * 一、排序和搜索是什么? * - 排序:把某个乱序的数组变成升序或者降序的数组 * - 搜索:找出数组中某个元素的下标 * 二、js中的排序和搜索 * - js中的排序:数组的sort方法 * - js中的搜索:数组的index
阅读全文
第一章、数据结构与算法
摘要:####一、数据结构与算法简介 #####1、理论 * 数据结构:栈、队列、集合、链表、字典、树、图、堆 * 进阶算法:冒泡算法、选择算法、插入算法、归并算法、快速算法、顺序算法、二分搜索 * 算法设计思想:分而治之、动态规则、贪心、回溯 * 重点关注:数据结构与算法的特点、应用场景、js实现、时间
阅读全文
canvas画以中心点旋转的矩形
摘要:<template> <!--canvas要绑定键盘事件,首先要具有焦点(focus)。canvas、div等要具有焦点,元素要添加【tabindex="0"】属性--> <canvas id="cvs" width="600" height="600" style="background-colo
阅读全文
洗牌算法
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>体彩大乐透</title> </head> <body> <div i
阅读全文
二分查找
摘要:public class BinarySearch { public static void main(String[] args) { int[] arr = {10, 20, 30, 40, 50, 60, 70, 80, 90}; int num = 70; System.out.printl
阅读全文
递归
摘要:import java.io.File; public class Recursion { public static void main(String[] args) { File file = new File("E:\\study\\JAVA全套整理"); RecursionMethods(f
阅读全文
选择排序+冒泡排序
摘要:import java.util.Arrays; public class Arrsort { public static void main(String[] args) { int[] arr = {5, 8, 3, 4, 9, 2, 7, 6, 1}; System.out.println(A
阅读全文