1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-23 10:10:56 +08:00

feat: 移除eslint相关配置,引入@antfu/eslint-config,统一约束风格

This commit is contained in:
142vip.cn
2024-09-25 15:16:40 +08:00
parent e792ed40b2
commit 9303820456
134 changed files with 10220 additions and 1804 deletions

View File

@@ -20,7 +20,8 @@ function binaryInsertSort(arr, len) {
if (arr[mid] <= temp) {
// 右侧
lowIndex = mid + 1
} else {
}
else {
// 左侧
highIndex = mid - 1
}
@@ -35,10 +36,8 @@ function binaryInsertSort(arr, len) {
return arr
}
// 测试用例
const dealArr = [5, 2, 7, 3, 18, 8, 12, 1]
console.log('插入排序前:', dealArr)
const sortResult = binaryInsertSort(dealArr, 7)
console.log('插入排序后:', sortResult)

View File

@@ -19,7 +19,6 @@ function QuickSort(arr, low, high) {
return arr
}
/**
*
* 寻找数组中的基准pivot使得左侧元素全部小于等于pivot右侧元素全部大于等于pivot
@@ -47,7 +46,6 @@ function Partition(arr, low, high) {
return low
}
const initArr = [2, 18, 6, 25, 19, 4, 8, 3, 7]
console.log(`快速排序处理前:${initArr}`)
const quickSortResult = QuickSort(initArr, 0, 8)

View File

@@ -34,7 +34,6 @@ function specialStraightInsertSort(arr, len, increment, groupIndex) {
for (let eleStartIndex = groupIndex + increment; eleStartIndex < len; eleStartIndex += increment) {
// 此时eleStartIndex为直接插入排序的比较元素
// 直接插入排序中的哨兵元素【重要】
const temp = arr[eleStartIndex]
let j
@@ -49,13 +48,11 @@ function specialStraightInsertSort(arr, len, increment, groupIndex) {
return arr
}
const dealArr = [5, 8, 2, 16, 3, 9, 1]
console.log('插入排序前:', dealArr)
const sortResult = shellSort(dealArr, 7)
console.log('插入排序后:', sortResult)
/**
* 简化的希尔排序
* - 返回已排序号的数组,从小到大
@@ -77,7 +74,6 @@ function shellSortBetter(arr) {
return arr
}
console.log('简化shellSortBetter希尔排序前', dealArr)
const sortResultBetter = shellSortBetter(dealArr)
console.log('简化shellSortBetter希尔排序后', sortResultBetter)

View File

@@ -30,5 +30,3 @@ console.log('插入排序前:', dealArr)
const sortResult = straightInsertSort(dealArr, 7)
console.log('插入排序后:', sortResult)

View File

@@ -20,7 +20,8 @@ function binaryInsertSort(arr, len) {
if (arr[mid] <= temp) {
// 右侧
lowIndex = mid + 1
} else {
}
else {
// 左侧
highIndex = mid - 1
}
@@ -35,10 +36,8 @@ function binaryInsertSort(arr, len) {
return arr
}
// 测试用例
const dealArr = [5, 2, 7, 3, 18, 8, 12, 1]
console.log('插入排序前:', dealArr)
const sortResult = binaryInsertSort(dealArr, 7)
console.log('插入排序后:', sortResult)

View File

@@ -19,7 +19,6 @@ function QuickSort(arr, low, high) {
return arr
}
/**
*
* 寻找数组中的基准pivot使得左侧元素全部小于等于pivot右侧元素全部大于等于pivot
@@ -47,7 +46,6 @@ function Partition(arr, low, high) {
return low
}
const initArr = [2, 18, 6, 25, 19, 4, 8, 3, 7]
console.log(`快速排序处理前:${initArr}`)
const quickSortResult = QuickSort(initArr, 0, 8)

View File

@@ -34,7 +34,6 @@ function specialStraightInsertSort(arr, len, increment, groupIndex) {
for (let eleStartIndex = groupIndex + increment; eleStartIndex < len; eleStartIndex += increment) {
// 此时eleStartIndex为直接插入排序的比较元素
// 直接插入排序中的哨兵元素【重要】
const temp = arr[eleStartIndex]
let j
@@ -49,13 +48,11 @@ function specialStraightInsertSort(arr, len, increment, groupIndex) {
return arr
}
const dealArr = [5, 8, 2, 16, 3, 9, 1]
console.log('插入排序前:', dealArr)
const sortResult = shellSort(dealArr, 7)
console.log('插入排序后:', sortResult)
/**
* 简化的希尔排序
* - 返回已排序号的数组,从小到大
@@ -77,7 +74,6 @@ function shellSortBetter(arr) {
return arr
}
console.log('简化shellSortBetter希尔排序前', dealArr)
const sortResultBetter = shellSortBetter(dealArr)
console.log('简化shellSortBetter希尔排序后', sortResultBetter)

View File

@@ -30,5 +30,3 @@ console.log('插入排序前:', dealArr)
const sortResult = straightInsertSort(dealArr, 7)
console.log('插入排序后:', sortResult)

View File

@@ -20,7 +20,8 @@ function binaryInsertSort(arr, len) {
if (arr[mid] <= temp) {
// 右侧
lowIndex = mid + 1
} else {
}
else {
// 左侧
highIndex = mid - 1
}
@@ -35,10 +36,8 @@ function binaryInsertSort(arr, len) {
return arr
}
// 测试用例
const dealArr = [5, 2, 7, 3, 18, 8, 12, 1]
console.log('插入排序前:', dealArr)
const sortResult = binaryInsertSort(dealArr, 7)
console.log('插入排序后:', sortResult)

View File

@@ -3,7 +3,7 @@
* 给定一个数组,按照从小到大或从大到小排序,打印排序前后结果对比
* 编程语言TypeScript
*/
function BubbleSort(arr:Array<number>):number[] {
function BubbleSort(arr: Array<number>): number[] {
// 获取数组长度
const len = arr.length
@@ -33,10 +33,14 @@ function BubbleSort(arr:Array<number>):number[] {
return arr
}
interface SwitchValue {
a: number
b: number
}
/**
* 将两个变量数值交换
*/
function switchValue(params:{ a: number, b: number }):{a:number, b:number} {
function _switchValue(params: SwitchValue) {
const { a: newB, b: newA } = params
return { a: newA, b: newB }
}

View File

@@ -19,7 +19,6 @@ function QuickSort(arr, low, high) {
return arr
}
/**
*
* 寻找数组中的基准pivot使得左侧元素全部小于等于pivot右侧元素全部大于等于pivot
@@ -47,7 +46,6 @@ function Partition(arr, low, high) {
return low
}
const initArr = [2, 18, 6, 25, 19, 4, 8, 3, 7]
console.log(`快速排序处理前:${initArr}`)
const quickSortResult = QuickSort(initArr, 0, 8)

View File

@@ -34,7 +34,6 @@ function specialStraightInsertSort(arr, len, increment, groupIndex) {
for (let eleStartIndex = groupIndex + increment; eleStartIndex < len; eleStartIndex += increment) {
// 此时eleStartIndex为直接插入排序的比较元素
// 直接插入排序中的哨兵元素【重要】
const temp = arr[eleStartIndex]
let j
@@ -49,13 +48,11 @@ function specialStraightInsertSort(arr, len, increment, groupIndex) {
return arr
}
const dealArr = [5, 8, 2, 16, 3, 9, 1]
console.log('插入排序前:', dealArr)
const sortResult = shellSort(dealArr, 7)
console.log('插入排序后:', sortResult)
/**
* 简化的希尔排序
* - 返回已排序号的数组,从小到大
@@ -77,7 +74,6 @@ function shellSortBetter(arr) {
return arr
}
console.log('简化shellSortBetter希尔排序前', dealArr)
const sortResultBetter = shellSortBetter(dealArr)
console.log('简化shellSortBetter希尔排序后', sortResultBetter)

View File

@@ -30,5 +30,3 @@ console.log('插入排序前:', dealArr)
const sortResult = straightInsertSort(dealArr, 7)
console.log('插入排序后:', sortResult)