![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Algorithm
听七里香的那位少年郎
从今天开始努力
展开
-
mark一下数组去重(set、reduce、foreach、filter、for、indexof、includes)
数组去重 方法千万条,好用第一条,废话不多说,直接上代码 通过Set集合的唯一性 const generalArr = [1, 3, 4, 5, 4, 2, 500, 9, 9, 1, 100]; ;(function uniqueArray(arr) { // let result = [...new Set(arr)]; // 或者 let result = Array.from(new Set(arr)) console.log(result); })(generalArr) 通过forE原创 2021-04-14 14:27:46 · 189 阅读 · 0 评论 -
[Algorithm]Selection_选择排序算法代码实现
话不多说,上菜: public class Selection { public static void main(String[] args) { //test int[] arr = {5,2,9,3,4}; selectionSort(arr); show(arr); } //选择排序 public static void selectionSort(int...原创 2020-04-16 13:51:59 · 157 阅读 · 0 评论 -
[Algorithm]Bubble_冒泡算法代码实现
话不多说,上菜: public class Bubble { public static void main(String[] args) { //test int[] arr = {5,2,9,3,4}; bubbleSort(arr); show(arr); } //冒泡 public static void bubbleSort(int[] arr) { ...原创 2020-04-16 13:39:51 · 140 阅读 · 0 评论