算法leetcode基础day6

P1923 【深基9.例4】求第 k 小的数(快速选择算法)

题解: 利用快速排序的思想来寻找第k小的数,可以避免很多不必要的操作 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 5000005, M = 5e6 + 5; 4 int x[N], k; 5 inline int ......
算法 P1923 1923

前端基础-js

一.Map和Set有什么区别 在JavaScript中,Map和Set都是ES6引入的新的数据结构,但它们有一些关键的区别。Map:1. Map主要用于键值对的存储。每个元素由一对键值组成。2. Map中的键可以是任何类型,包括函数、对象等。3. Map的键是有序的,因此当对Map进行遍历时,元素的 ......
前端 基础 js

docker笔记 - 基础存档

![image-20220629215534772](https://img2023.cnblogs.com/blog/2222630/202308/2222630-20230818165430534-585932208.png) # Docker容器技术 Docker是一门平台级别的技术,涉及的范 ......
基础 笔记 docker

.net Core基础仓储模型

.netCore简单仓储模型 共分为三层: 仓储层:Repository(类),IRepository(接口) 业务层:Service(类),IService(接口) 表现层:Controller(控制器接口层) 如图所示: Repository层 继承IRepository IbaseReposi ......
模型 基础 Core net

TFIDF改进版:BM25算法介绍及Lucene的实现

# 优化TF ## TF衰减 > 思考一个问题:一篇文档,里面有提到200次RedCap,一定是2倍相关于另一篇提到100次RedCap吗? $TF$对匹配度的贡献应该是有所衰减的。如何控制衰减曲线的陡峭程度?构造$TF$衰减的匹配度函数的一个trick是引入参数$k$: $$ {TF}^\prim ......
算法 Lucene TFIDF BM 25

java基础11包机制

# 包机制(可以类比为文件夹) - 为了更好地组织类,java提供了暴击值,用于区别类名的命名空间 - 包语句的语法格式: `package pkg1[.pkg2[.pkg3...]];`(**必须放在最上面) 例如 package com.abc.www - **一般利用公司域名倒置作为包名** ......
机制 基础 java

java基础07基本运算符

# 基本运算符 - 算数运算符:+ - * / % ++ -- (如果加减乘除中有一个为long则结果为long,其余都为int) - 赋值运算符:= - 关系运算符:> = > >>(需要简单了解!!) - 条件运算符 ? : - 扩展运算符:+= -= *= /= ......
运算符 基础 java

java基础12JavaDoc生成文档

# JavaDoc生成文档 - javadoc命令是用来生成自己的API文档的 - 参数信息 - @author作者名 - @version版本号 - @since指明需要最早使用的jdk版本 - @param参数名 - @return返回值情况 - @throws异常抛出情况 **1.可以加在类上 ......
JavaDoc 文档 基础 java 12

java基础09逻辑运算符,位运算符

# 逻辑运算符,位运算符 ## 参考C语言 ### 逻辑运算符 - && 和(and) - || 或(or) - ! 非(取反) [短路运算:`boolean d=(c>‘有符号’右移:相当于除以2 (/2) - a>>‘无符号’右移:PS:无论正负,都在高位插入0 **低位:指在数据类型限定范围内 ......
运算符 逻辑 基础 java

java基础08自增自减运算符,初识Math类

# 自增自减运算符,初识Math类 ### 自增自减与C语言相同 - a++ 先用一次之后再加一 (a--相对应),例如: ```java int a=1; int b=a++; int c=a; //三者值变为a=2,b=1,c=2 ``` - ++a 立刻加一并开始用(--a相对应),例如: ` ......
运算符 基础 java Math

java基础01注释

# 注释 //单行注释 /* 多行注释 */ /** *文档注释(含有其他内容如下) *@author 等等等 */ > javaDoc:文档注释 // ctrl + D 复制当前行到下一行(IDEA里面的快捷键) ......
注释 基础 java

java基础03数据类型

# 数据类型 ### 1.强类型语言 要求变量的使用严格符合规定,所有变量都必须先定义后才能使用 ### 2.弱类型语言 ​ 要求变量的使用符合规定,所有变量都必须先定义后才能使用(如VB,JS) ### 3.JAVA数据类型分为两大类 - 基本类型(primitive type): 数值类型: 1 ......
类型 基础 数据 java

java基础05类型转换

# 类型转换 - 由于Java是强类型语言,所以要进行有些运算的时候,需要用类型转换 低 >高 byte,short,char ->int ->long ->float ->double ***最好从地位向高位转换,从高向低转换可能会内存溢出,也就是超过范围*** /*注意点: *1.不可以对布尔值 ......
类型 基础 java

java基础04数据类型扩展

# 数据类型扩展 ### 整数拓展: ​ **进制在JAVA内的表示方法: ** ​ 二进制0b 八进制0 十六进制0x 十进制(不需要) ### 浮点数拓展: ​ **float和double存在问题**: ​ 表现的字长有限 离散 舍入误差 大约 接近但不等于 ​ *银行业务使用BigDecim ......
类型 基础 数据 java

java基础06变量、常量、作用域

# 变量、常量、作用域 ## 变量 - 变量,即可以变化的量 - java是一种强类型语言,每个变量都必须声明其类型 - java变量是程序中最基本的存储单元,其要素包括变量名,变量类型和作用域 ```java type varName [=value] [{,varName[=value]}]; ......
常量 变量 作用 基础 java

java基础02标识符和关键字

# 标识符与关键字 * Java所有的组成部分都需要名字。类名、变量名以及方法名都被称为标识符 * 标识符必须以大写字母(A-Z)或者小写字母(a-z)、美元符号($)、下划线(_)开头 * 标识符首字符后可以是大写字母(A-Z)或者小写字母(a-z)、美元符号($)、下划线(_)、数字(1-9)的 ......
标识符 标识 关键字 关键 基础

常用算法

算法主要是由头文件 <algorithm> <functional> <numeric> 组成。 <algorithm> 是所有 STL 头文件中最大的一个,范围涉及到比较、交换、查找、遍历操作、复制、修改等等 <nuneric> 体积很小,只包括几个在序列上面进行简单数学运算的模板函数 <func ......
算法 常用

C++快速入门 第四十七讲:容器和算法

C++标准库提供的向量(vector)类型从根本上解决了数组先天不足的问题(内存固定,如果不用那么多内存编译器也会为其分配) 我们用不着对一个向量能容纳多少元素做出限定,因为向量可以动态地随着你往它里面添加元素而无限增大。还可以用它的size()方法查知某给定向量的当前长度(即包含的元素个数);用p ......
算法 容器

[LeetCode][70]climbing-stairs

# Content You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can ......
climbing-stairs LeetCode climbing stairs 70

[LeetCode][53]maximum-subarray

# Content Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Ou ......

[LeetCode][55]jump-game

# Content You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ......
jump-game LeetCode jump game 55

[LeetCode][62]unique-paths

# Content There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the ......
unique-paths LeetCode unique paths 62

[LeetCode][42]trapping-rain-water

# Content Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini ......

[LeetCode][10]regular-expression-matching

# Content Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single ch ......

[LeetCode][32]longest-valid-parentheses

# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......

[LeetCode][64]minimum-path-sum

# Content Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along ......
minimum-path-sum LeetCode minimum path sum

双指针算法

# 双指针算法 ```c++ for(int i=0, j=0; i using namespace std; const int N = 100010; int a[N], s[N];//s数组用来判断 j ~ i 之间有没有重复的 int main(){ int n; cin>>n; for(i ......
指针 算法

LeetCode[10]RegularExpressionMatching

# Content Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single ch ......
RegularExpressionMatching LeetCode 10

LeetCode[32]LongestValidParentheses

# Content Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Examp ......
LongestValidParentheses LeetCode 32

LeetCode[42]TrappingRainWater

# Content Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raini ......
TrappingRainWater LeetCode 42