数据结构与算法JavaScript描述练习------第12章排序算法

1. 使用本章讨论的所有算法对字符串数据而非数字数据进行排序,并比较不同算法的执行 时间。这两者的结果是否一致呢?

function CArray(numElements) { this.dataStore = []; this.pos = 0; this.numElements = numElements; this.insert = insert; this.toString = toString; this.clear = clear; this.setData = setData; this.swap = swap; /*for ( var i = 0; i < numElements; ++i ) { this.dataStore[i] = i; }*/for ( var i = 0; i < numElements; ++i ) { this.dataStore[i] = String.fromCharCode(65 + i % 26); }this.bubbleSort = bubbleSort;this.selectionSort = selectionSort;this.insertionSort = insertionSort;this.gaps = [5,3,1];this.shellsort = shellsort;this.shellsort1 = shellsort1;this.mergeSort = mergeSort; this.mergeArrays = mergeArrays;
}/*
function setData() { for ( var i = 0; i < this.numElements; ++i ) { this.dataStore[i] = Math.floor(Math.random() * (this.numElements + 1)); } 
} 
*/
function setData() { for ( var i = 0; i < this.numElements; ++i ) { this.dataStore[i] = String.fromCharCode(65 + Math.floor(Math.random() * 26)); } 
} function clear() { for ( var i = 0; i < this.dataStore.length; ++i ) { this.dataStore[i] = 0; } 
} function insert(element) { this.dataStore[this.pos++] = element; 
} function toString() { var retstr = ''; for ( var i = 0; i < this.dataStore.length; ++i ) { retstr += this.dataStore[i] + " "; if (i > 0 & i % 10 == 0) { retstr += "\n"; } } return retstr; 
} function swap(arr, index1, index2) { var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; 
}function bubbleSort() { for ( var i = this.dataStore.length; i > 1; --i) { for ( var j = 0; j < i - 1; ++j ) { if (this.dataStore[j] > this.dataStore[j + 1]) { swap(this.dataStore, j, j + 1); } }//console.log(this.dataStore);} 
}function selectionSort() { for (var i = 0; i < this.dataStore.length-1; ++i) { for (var j = i + 1; j < this.dataStore.length; ++j) { if (this.dataStore[j] < this.dataStore[i]) { swap(this.dataStore, i, j); } } //console.log(this.dataStore);} 
}function insertionSort() { for (var i = 1; i < this.dataStore.length; ++i) { for (var j = i; j > 0; j--) { if (this.dataStore[j - 1] > this.dataStore[j]) {swap(this.dataStore, j, j - 1);}} //console.log(this.dataStore);} 
}function shellsort() { for (var g = 0; g < this.gaps.length; ++g) { for (var i = this.gaps[g]; i < this.dataStore.length; ++i) { for (var j = i; j >= this.gaps[g] && this.dataStore[j-this.gaps[g]] > this.dataStore[j]; j -= this.gaps[g]) { swap(this.dataStore, j, j - this.gaps[g]);} //console.log(this.dataStore);} } 
}function shellsort1() { var N = this.dataStore.length; var h = 1; while (h < N/3) { h = 3 * h + 1; } while (h >= 1) { for (var i = h; i < N; i++) { for (var j = i; j >= h && this.dataStore[j] < this.dataStore[j-h]; j -= h) { swap(this.dataStore, j, j-h); } //console.log(this.dataStore);} h = (h-1)/3; } 
}function mergeArrays(arr,startLeft, stopLeft, startRight, stopRight) { var rightArr = arr.slice(startRight, stopRight + 1); var leftArr  = arr.slice(startLeft,  stopLeft  + 1);rightArr.push(Infinity);leftArr.push(Infinity);var m = 0; var n = 0; for (var k = startLeft; k <= stopRight; ++k) { if (leftArr[m] <= rightArr[n]) { arr[k] = leftArr[m]; m++; } else { arr[k] = rightArr[n]; n++; } } //console.log("left array - ", leftArr); //console.log("right array - ", rightArr); 
} function mergeSort() { if (this.dataStore.length < 2) { return; } var step = 1; while (step < this.dataStore.length) { var left = 0; var right = step; while (right + step <= this.dataStore.length) { mergeArrays(this.dataStore, left, left + step - 1, right, right + step - 1); left = right + step; right = left + step; } if (right < this.dataStore.length) { mergeArrays(this.dataStore, left, left + step - 1, right, this.dataStore.length - 1); } step *= 2; } 
} function qSort(list) { if (list.length <= 1) { return list; } var lesser = []; var greater = []; var equal = [];var pivotIndex = Math.floor(list.length / 2);var pivot = list[pivotIndex]; for (var i = 0; i < list.length; i++) { if (i == pivotIndex) {continue;}if (list[i] < pivot) { lesser.push(list[i]); } else if (list[i] > pivot) { greater.push(list[i]); } else {equal.push(list[i]);}}return qSort(lesser).concat([pivot], equal, qSort(greater)); 
}function measureExecutionTime(sortFunction, context) {var startTime = performance.now();if (context instanceof CArray) {sortFunction.call(context);} else {context = sortFunction(context);}var endTime = performance.now();return endTime - startTime;
}var numElements = 30000;
var cArray = new CArray(numElements);
cArray.setData();
var algorithms = [{ name: 'Bubble Sort', func: cArray.bubbleSort, context: cArray },{ name: 'Selection Sort', func: cArray.selectionSort, context: cArray },{ name: 'Insertion Sort', func: cArray.insertionSort, context: cArray },{ name: 'Shell Sort', func: cArray.shellsort, context: cArray },{ name: 'Shell Sort 1', func: cArray.shellsort1, context: cArray },{ name: 'Merge Sort', func: cArray.mergeSort, context: cArray },{ name: 'Quick Sort', func: qSort, context: cArray.dataStore.slice() }
];
algorithms.forEach(algo => {var time = measureExecutionTime(algo.func, algo.context);console.log(`${algo.name}: ${time.toFixed(2)} ms`);
});//Bubble Sort: 3131.30 ms
//Selection Sort: 2211.20 ms
//Insertion Sort: 1556.70 ms
//Shell Sort: 2.30 ms
//Shell Sort 1: 2.30 ms
//Merge Sort: 18.80 ms
//Quick Sort: 5.60 ms

2. 创建一个包含 1000 个整数的有序数组。编写一个程序,用本章讨论的所有算法对这个 数组排序,分别记下它们的执行时间,并进行比较。如果对一个无序的数组进行排序结 果又会怎样?

function CArray(numElements) { this.dataStore = []; this.pos = 0; this.numElements = numElements; this.insert = insert; this.toString = toString; this.clear = clear; this.setData = setData; this.swap = swap; for ( var i = 0; i < numElements; ++i ) { this.dataStore[i] = i; }/*for ( var i = 0; i < numElements; ++i ) { this.dataStore[i] = String.fromCharCode(65 + i % 26); }*/this.bubbleSort = bubbleSort;this.selectionSort = selectionSort;this.insertionSort = insertionSort;this.gaps = [5,3,1];this.shellsort = shellsort;this.shellsort1 = shellsort1;this.mergeSort = mergeSort; this.mergeArrays = mergeArrays;
}function setData() { for ( var i = 0; i < this.numElements; ++i ) { this.dataStore[i] = Math.floor(Math.random() * (this.numElements + 1)); } 
} /*
function setData() { for ( var i = 0; i < this.numElements; ++i ) { this.dataStore[i] = String.fromCharCode(65 + Math.floor(Math.random() * 26)); } 
} 
*/function clear() { for ( var i = 0; i < this.dataStore.length; ++i ) { this.dataStore[i] = 0; } 
} function insert(element) { this.dataStore[this.pos++] = element; 
} function toString() { var retstr = ''; for ( var i = 0; i < this.dataStore.length; ++i ) { retstr += this.dataStore[i] + " "; if (i > 0 & i % 10 == 0) { retstr += "\n"; } } return retstr; 
} function swap(arr, index1, index2) { var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; 
}function bubbleSort() { for ( var i = this.dataStore.length; i > 1; --i) { for ( var j = 0; j < i - 1; ++j ) { if (this.dataStore[j] > this.dataStore[j + 1]) { swap(this.dataStore, j, j + 1); } }//console.log(this.dataStore);} 
}function selectionSort() { for (var i = 0; i < this.dataStore.length-1; ++i) { for (var j = i + 1; j < this.dataStore.length; ++j) { if (this.dataStore[j] < this.dataStore[i]) { swap(this.dataStore, i, j); } } //console.log(this.dataStore);} 
}function insertionSort() { for (var i = 1; i < this.dataStore.length; ++i) { for (var j = i; j > 0; j--) { if (this.dataStore[j - 1] > this.dataStore[j]) {swap(this.dataStore, j, j - 1);}} //console.log(this.dataStore);} 
}function shellsort() { for (var g = 0; g < this.gaps.length; ++g) { for (var i = this.gaps[g]; i < this.dataStore.length; ++i) { for (var j = i; j >= this.gaps[g] && this.dataStore[j-this.gaps[g]] > this.dataStore[j]; j -= this.gaps[g]) { swap(this.dataStore, j, j - this.gaps[g]);} //console.log(this.dataStore);} } 
}function shellsort1() { var N = this.dataStore.length; var h = 1; while (h < N/3) { h = 3 * h + 1; } while (h >= 1) { for (var i = h; i < N; i++) { for (var j = i; j >= h && this.dataStore[j] < this.dataStore[j-h]; j -= h) { swap(this.dataStore, j, j-h); } //console.log(this.dataStore);} h = (h-1)/3; } 
}function mergeArrays(arr,startLeft, stopLeft, startRight, stopRight) { var rightArr = arr.slice(startRight, stopRight + 1); var leftArr  = arr.slice(startLeft,  stopLeft  + 1);rightArr.push(Infinity);leftArr.push(Infinity);var m = 0; var n = 0; for (var k = startLeft; k <= stopRight; ++k) { if (leftArr[m] <= rightArr[n]) { arr[k] = leftArr[m]; m++; } else { arr[k] = rightArr[n]; n++; } } //console.log("left array - ", leftArr); //console.log("right array - ", rightArr); 
} function mergeSort() { if (this.dataStore.length < 2) { return; } var step = 1; while (step < this.dataStore.length) { var left = 0; var right = step; while (right + step <= this.dataStore.length) { mergeArrays(this.dataStore, left, left + step - 1, right, right + step - 1); left = right + step; right = left + step; } if (right < this.dataStore.length) { mergeArrays(this.dataStore, left, left + step - 1, right, this.dataStore.length - 1); } step *= 2; } 
} function qSort(list) { if (list.length <= 1) { return list; } var lesser = []; var greater = []; var equal = [];var pivotIndex = Math.floor(list.length / 2);var pivot = list[pivotIndex]; for (var i = 0; i < list.length; i++) { if (i == pivotIndex) {continue;}if (list[i] < pivot) { lesser.push(list[i]); } else if (list[i] > pivot) { greater.push(list[i]); } else {equal.push(list[i]);}}return qSort(lesser).concat([pivot], equal, qSort(greater)); 
}var numElements = 30000;
var orderedArray = new CArray(numElements);
var unorderedArray = new CArray(numElements);
unorderedArray.setData();
function testSortingAlgorithms(array, name) {console.log(`\n排序 ${name} 数组:`);var arrays = [{ name: '冒泡排序', method: 'bubbleSort' },{ name: '选择排序', method: 'selectionSort' },{ name: '插入排序', method: 'insertionSort' },{ name: '希尔排序(固定间隔)', method: 'shellsort' },{ name: '希尔排序(动态间隔)', method: 'shellsort1' },{ name: '归并排序', method: 'mergeSort' },{ name: '快速排序', method: 'qSort' }];arrays.forEach(({ name, method }) => {var startTime = performance.now();if (method === 'qSort') {array.dataStore = qSort(array.dataStore.slice());} else {array[method]();}var endTime = performance.now();console.log(`${name}: ${(endTime - startTime).toFixed(2)} 毫秒`);});
}
testSortingAlgorithms(orderedArray, '有序');
testSortingAlgorithms(unorderedArray, '无序');
//排序 有序 数组:
//冒泡排序: 939.90 毫秒
//选择排序: 318.00 毫秒
//插入排序: 828.70 毫秒
//希尔排序(固定间隔): 2.50 毫秒
//希尔排序(动态间隔): 1.90 毫秒
//归并排序: 12.20 毫秒
//快速排序: 14.20 毫秒
//
//排序 无序 数组:
//冒泡排序: 1374.60 毫秒
//选择排序: 306.50 毫秒
//插入排序: 811.00 毫秒
//希尔排序(固定间隔): 1.20 毫秒
//希尔排序(动态间隔): 2.30 毫秒
//归并排序: 8.60 毫秒
//快速排序: 14.10 毫秒

3. 创建一个包含 1000 个整数的倒序数组。编写一个程序,用本章讨论的所有算法对这个 数组排序,分别记下它们的执行时间,并进行比较。

function CArray(numElements) { this.dataStore = []; this.pos = 0; this.numElements = numElements; this.insert = insert; this.toString = toString; this.clear = clear; this.setData = setData; this.swap = swap; for ( var i = 0; i < numElements; ++i ) { this.dataStore[i] = i; }/*for ( var i = 0; i < numElements; ++i ) { this.dataStore[i] = String.fromCharCode(65 + i % 26); }*/this.bubbleSort = bubbleSort;this.selectionSort = selectionSort;this.insertionSort = insertionSort;this.gaps = [5,3,1];this.shellsort = shellsort;this.shellsort1 = shellsort1;this.mergeSort = mergeSort; this.mergeArrays = mergeArrays;
}function setData() { for ( var i = 0; i < this.numElements; ++i ) { this.dataStore[i] = Math.floor(Math.random() * (this.numElements + 1)); } 
} /*
function setData() { for ( var i = 0; i < this.numElements; ++i ) { this.dataStore[i] = String.fromCharCode(65 + Math.floor(Math.random() * 26)); } 
} 
*/function clear() { for ( var i = 0; i < this.dataStore.length; ++i ) { this.dataStore[i] = 0; } 
} function insert(element) { this.dataStore[this.pos++] = element; 
} function toString() { var retstr = ''; for ( var i = 0; i < this.dataStore.length; ++i ) { retstr += this.dataStore[i] + " "; if (i > 0 & i % 10 == 0) { retstr += "\n"; } } return retstr; 
} function swap(arr, index1, index2) { var temp = arr[index1]; arr[index1] = arr[index2]; arr[index2] = temp; 
}function bubbleSort() { for ( var i = this.dataStore.length; i > 1; --i) { for ( var j = 0; j < i - 1; ++j ) { if (this.dataStore[j] > this.dataStore[j + 1]) { swap(this.dataStore, j, j + 1); } }//console.log(this.dataStore);} 
}function selectionSort() { for (var i = 0; i < this.dataStore.length-1; ++i) { for (var j = i + 1; j < this.dataStore.length; ++j) { if (this.dataStore[j] < this.dataStore[i]) { swap(this.dataStore, i, j); } } //console.log(this.dataStore);} 
}function insertionSort() { for (var i = 1; i < this.dataStore.length; ++i) { for (var j = i; j > 0; j--) { if (this.dataStore[j - 1] > this.dataStore[j]) {swap(this.dataStore, j, j - 1);}} //console.log(this.dataStore);} 
}function shellsort() { for (var g = 0; g < this.gaps.length; ++g) { for (var i = this.gaps[g]; i < this.dataStore.length; ++i) { for (var j = i; j >= this.gaps[g] && this.dataStore[j-this.gaps[g]] > this.dataStore[j]; j -= this.gaps[g]) { swap(this.dataStore, j, j - this.gaps[g]);} //console.log(this.dataStore);} } 
}function shellsort1() { var N = this.dataStore.length; var h = 1; while (h < N/3) { h = 3 * h + 1; } while (h >= 1) { for (var i = h; i < N; i++) { for (var j = i; j >= h && this.dataStore[j] < this.dataStore[j-h]; j -= h) { swap(this.dataStore, j, j-h); } //console.log(this.dataStore);} h = (h-1)/3; } 
}function mergeArrays(arr,startLeft, stopLeft, startRight, stopRight) { var rightArr = arr.slice(startRight, stopRight + 1); var leftArr  = arr.slice(startLeft,  stopLeft  + 1);rightArr.push(Infinity);leftArr.push(Infinity);var m = 0; var n = 0; for (var k = startLeft; k <= stopRight; ++k) { if (leftArr[m] <= rightArr[n]) { arr[k] = leftArr[m]; m++; } else { arr[k] = rightArr[n]; n++; } } //console.log("left array - ", leftArr); //console.log("right array - ", rightArr); 
} function mergeSort() { if (this.dataStore.length < 2) { return; } var step = 1; while (step < this.dataStore.length) { var left = 0; var right = step; while (right + step <= this.dataStore.length) { mergeArrays(this.dataStore, left, left + step - 1, right, right + step - 1); left = right + step; right = left + step; } if (right < this.dataStore.length) { mergeArrays(this.dataStore, left, left + step - 1, right, this.dataStore.length - 1); } step *= 2; } 
} function qSort(list) { if (list.length <= 1) { return list; } var lesser = []; var greater = []; var equal = [];var pivotIndex = Math.floor(list.length / 2);var pivot = list[pivotIndex]; for (var i = 0; i < list.length; i++) { if (i == pivotIndex) {continue;}if (list[i] < pivot) { lesser.push(list[i]); } else if (list[i] > pivot) { greater.push(list[i]); } else {equal.push(list[i]);}}return qSort(lesser).concat([pivot], equal, qSort(greater)); 
}var numElements = 30000;
var reverseArray = new CArray(numElements);
function testSortingAlgorithms(array, name) {console.log(`\n排序 ${name} 数组:`);var arrays = [{ name: '冒泡排序', method: 'bubbleSort' },{ name: '选择排序', method: 'selectionSort' },{ name: '插入排序', method: 'insertionSort' },{ name: '希尔排序(固定间隔)', method: 'shellsort' },{ name: '希尔排序(动态间隔)', method: 'shellsort1' },{ name: '归并排序', method: 'mergeSort' },{ name: '快速排序', method: 'qSort' }];arrays.forEach(({ name, method }) => {var startTime = performance.now();if (method === 'qSort') {array.dataStore = qSort(array.dataStore.slice());} else {array[method]();}var endTime = performance.now();console.log(`${name}: ${(endTime - startTime).toFixed(2)} 毫秒`);});
}
testSortingAlgorithms(reverseArray, '倒序');
//排序 倒序 数组:
//冒泡排序: 939.10 毫秒
//选择排序: 314.90 毫秒
//插入排序: 775.60 毫秒
//希尔排序(固定间隔): 2.10 毫秒
//希尔排序(动态间隔): 1.70 毫秒
//归并排序: 10.70 毫秒
//快速排序: 14.10 毫秒

4. 创建一个包含 10 000 个随机整数的数组,使用快速排序和 JavaScript 内置的排序函数分 别对它进行排序,记录下它们的执行时间。这两种方法在执行时间上是否有区别?

function qSort(list) { if (list.length <= 1) { return list; } var lesser = []; var greater = []; var equal = [];var pivotIndex = Math.floor(list.length / 2);var pivot = list[pivotIndex]; for (var i = 0; i < list.length; i++) { if (i == pivotIndex) {continue;}if (list[i] < pivot) { lesser.push(list[i]); } else if (list[i] > pivot) { greater.push(list[i]); } else {equal.push(list[i]);}}return qSort(lesser).concat([pivot], equal, qSort(greater)); 
}function builtInSort(array) {return array.sort((a, b) => a - b);
}function createRandomArray(numElements) {var randomArray = [];for (var i = 0; i < numElements; i++) {randomArray.push(Math.floor(Math.random() * 1000000));}return randomArray;
}var numElements = 30000;
var randomArray = createRandomArray(numElements);function measureExecutionTime(sortFunction, array) {var startTime = performance.now();sortFunction(array);var endTime = performance.now();return endTime - startTime;
}var quickSortCopy = [...randomArray];
var quickSortTime = measureExecutionTime(qSort, quickSortCopy);
console.log(`Quick Sort: ${quickSortTime.toFixed(2)} ms`);
var builtInSortCopy = [...randomArray];
var builtInSortTime = measureExecutionTime(builtInSort, builtInSortCopy);
console.log(`Built-in Sort: ${builtInSortTime.toFixed(2)} ms`);//Quick Sort: 16.60 ms
//Built-in Sort: 9.20 ms

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/55297.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

HTTP安全么?如何更好的保护您的网站

在互联网飞速发展的今天&#xff0c;网络安全问题日益严峻。HTTP作为最常见的网络通信协议&#xff0c;虽然在传输效率方面表现优异&#xff0c;但其安全性却常常令人担忧。许多企业和个人网站在使用HTTP进行数据传输时&#xff0c;可能忽视了其中潜在的风险。那么&#xff0c;…

搜维尔科技:SenseGlove Nova 2触觉反馈手套开箱测评

SenseGlove Nova 2触觉反馈手套开箱测评 搜维尔科技&#xff1a;SenseGlove Nova 2触觉反馈手套开箱测评

react函数组件和类组件

react函数组件和类组件 函数组件会捕获render内部的差异&#xff0c;性能主要取决于代码正在进行的操作&#xff0c;函数组件和类组件区别可以忽略不计&#xff0c;但是优化策略是有不同的。 类组件 class Welcome extends React.Component {render() {return <h1>{th…

大模型入门到精通!大模型应用开发极简入门(含PDF)

大模型的出现正悄然改变人们的生活与工作方式&#xff0c;比如ChatGPT-4、文心一言、通义千问等语言大模型。它们已帮助很多办公室“白领”们在解决日常工作问题&#xff0c;如制定计划、撰写实施方案&#xff0c;甚至制作美化PPT等&#xff08;笔者及身边的同事在工作中还经常…

OpenCV人脸检测与识别:构建智能识别系统

在当今科技日新月异的时代&#xff0c;人脸识别技术以其独特的便利性和安全性&#xff0c;在各个领域都展现出了巨大的应用潜力。从智能手机的面部解锁&#xff0c;到机场的自动安检&#xff0c;再到商场的顾客行为分析&#xff0c;人脸识别技术无处不在。本文将深入探讨如何使…

简单认识redis - 9 布隆过滤器

布隆过滤器&#xff08;Bloom Filter&#xff09;是一种空间效率很高的随机数据结构&#xff0c;用于判断一个元素是否可能在一个集合中。 一、工作原理 1. 初始化&#xff1a; 布隆过滤器由一个位数组&#xff08;通常是一个很长的二进制数组&#xff09;和若干个哈希函数组…

【scene_manager_msgs】ROS2 自定义消息、服务的包

scene_manager_msgs 在ROS 1向ROS 2迁移的过程中&#xff0c;有些依赖项发生了变化&#xff0c;这是因为ROS 2的通信框架和工具链与ROS 1不同&#xff0c;尤其在消息、服务和动作生成方面有了一些新的方法和库。 动作库 如果你的ROS 1包依赖于actionlib或actionlib_msgs&…

拍立淘API返回值中的商品列表与详细信息解析

拍立淘&#xff08;Pailitao&#xff09;是阿里巴巴旗下的一种图像识别购物技术&#xff0c;允许用户通过拍摄商品照片来搜索相似的商品。尽管官方没有直接开放拍立淘的API给公众使用&#xff0c;但可以通过淘宝开放平台&#xff08;Taobao Open Platform&#xff09;的一些图像…

Python logging模块实现日志饶接 按照时间命名

import os import zipfile from datetime import datetime from logging.handlers import RotatingFileHandlerclass CompressedRotatingFileHandler(RotatingFileHandler):"""自定义的 RotatingFileHandler&#xff0c;支持在日志轮转时压缩旧日志文件&#xf…

【算法】深入理解布隆过滤器

1. 什么是布隆过滤器&#xff1f; 布隆过滤器&#xff08;Bloom Filter&#xff09;是一种空间效率极高的概率型数据结构&#xff0c;用于检测某个元素是否在一个集合中。与常见的数据结构如哈希表不同&#xff0c;布隆过滤器无法删除元素&#xff0c;并且会存在一定的误判率&…

用示波器观测RC一阶电路零输入响应是否激励必须是方波信号

概述 RC一阶电路是一种简单但非常重要的电路&#xff0c;广泛应用于滤波、信号处理和时间常数分析等领域。在研究RC电路的动态特性时&#xff0c;零输入响应&#xff08;Natural Response&#xff09;是一项关键内容。本文将详细解析用示波器观测RC一阶电路零输入响应时&#…

开发语言最佳实践

目录 一、开发IOS最好的语言是什么&#xff1f; 二、开发安卓的最好语言是什么&#xff1f; 三、开发鸿蒙应用最好的语言是什么&#xff1f; 四、做大模型训练最好的开发语言是什么&#xff1f; 一、开发IOS最好的语言是什么&#xff1f; 开发iOS最好的语言是Swift。Swift…

C#学习笔记(六)

C#学习笔记&#xff08;六&#xff09; 第 三 章 基本语句以及语法二、程序逻辑 if 选择和分支结构 switch1. if2. switch 三、循环语句1. for 循环的使用2. while 循环的使用3. 对比 break 和 continue 第 四 章 字符串 string 详解和高效 StringBuilder 类暂不练习与学习。 第…

CAD快捷键大全非常详细

绘图菜单 快捷键 注意事项 1.线 L 2.构造线 XL 3.多段线 PL 一般用来画三维图 4.正多边形 POL 5.矩形 REC 6.圆弧 A 7.圆 C 8.修订云线 REVCLOUD 9.样条曲线 SPL 10.椭圆 EL 轴测图&#xff1a;ELI 11.椭圆弧…

如何实现安川MP3300运动控制器与西门子1200系列PLC进行ModbusTCP通讯

在工业自动化中&#xff0c;实现不同品牌、不同型号设备之间的通讯是确保生产流程顺畅、高效运行的关键。本文详细介绍了安川MP3300运动控制器与西门子1200系列PLC进行ModbusTCP通讯的具体方法。 一&#xff0e;软硬件需求 1.一台安川MP3300CPU301&#xff0c;其IP地址是192.…

SpringCloudAlibaba升级手册

目录 1. 版本对照 版本现状 SpringCloud与AlibabaCloud对应版本 Springboot与Elasticsearch版本对应 2. openfeign问题 问题 解决方案 3. Feign请求问题 问题 解决方法 4. Sentinel循环依赖 问题 解决方案 5. bootstrap配置文件不生效 问题 解决方案 6. Nacos的…

Codeforces Round 929 (Div. 3) F. Turtle Mission: Robot and the Earthquake

题目 题解&#xff1a; 按题解思路的代码&#xff1a; #include <bits/stdc.h>using i64 long long;void solve() {int n, m;std::cin >> n >> m;std::vector a(n, std::vector<int>(m));for (int i 0; i < n; i) {for (int j 0; j < m; j) …

STM32—SPI通讯协议

前言 由于I2C开漏外加上拉电阻的电路结构&#xff0c;使得通信线高电平的驱动能力比较弱&#xff0c;这就会号致&#xff0c;通信线由候电平变到高电平的时候&#xff0c;这个上升沿耗时比较长&#xff0c;这会限制I2C的最大通信速度&#xff0c; 所以&#xff0c;I2C的标准模…

uniapp-小程序开发0-1笔记大全

uniapp官网&#xff1a; https://uniapp.dcloud.net.cn/tutorial/syntax-js.html uniapp插件市场&#xff1a; https://ext.dcloud.net.cn/ uviewui类库&#xff1a; https://www.uviewui.com/ 柱状、扇形、仪表盘库&#xff1a; https://www.ucharts.cn/v2/#/ CSS样式&…

经纬恒润荣获2024中国汽车供应链大会创新成果奖

2024年9月24日-26日&#xff0c;2024中国汽车供应链大会暨第三届中国新能源智能网联汽车生态大会在武汉隆重举办。本届大会以“新挑战、新对策、新机遇——推动中国汽车供应链可持续发展”为主题&#xff0c;集聚政府主管领导、行业专家、汽车及零部件企业精英和主流媒体&#…