c: Sorting Algorithms

SortAlgorithm.h

/*****************************************************************//*** \file   SortAlgorithm.h* \brief  业务操作方法* VSCODE   c11  https://github.com/hustcc/JS-Sorting-Algorithm/blob/master/2.selectionSort.md* https://www.programiz.com/dsa/counting-sort* https://www.geeksforgeeks.org/sorting-algorithms/* \author geovindu,Geovin Du* \date   2023-09-19
***********************************************************************/
#ifndef SORTALGORITHM_H
#define SORTALGORITHM_H#include <stdio.h>
#include <stdlib.h>/*** @brief 1。Bubble Sort冒泡排序法* @param data    INT 数组* @param lensize   数组长度** @return 排序好的数组*   *   */
int* BubbleSort(int* arrdata,int lensize);/*** @brief 2 C Program for Selection Sort 选择排序* @param arrdata    INT 数组int arrdata[]* @param lensize   数组长度** @return 返回说明*    *    */
void SelectionSort(int* arrdata, int lensize);/*** @brief 3 Insertion Sort插入排序* @param arrdata    INT 数组int arrdata[]* @param lensize   数组长度** @return 返回说明*   *   */void InsertionSort(int* arrdata, int lensize);/*** @brief 4 Quick Sort 快速排序* @param arrdata    INT 数组* @param start   数组长度开始值* @param end     数组长度结束值* @return 返回说明*   *   */
void QuickSort(int* arrdata, int start, int end);/*** @brief 5 Merge Sort 合并排序* @param arrdata    INT 数组* @param start   数组长度开始值* @param end     数组长度结束值* @return 返回说明*   *    */
void MergeSort(int* arrdata, int const begin, int const end);/*** @brief 6 Counting Sort 计数排序* @param arrdata    INT 数组* @param lensize   数组长度* @return 返回说明*    *    */
void CountingSort(int* arrdata, int lensize);/*** @brief 7 Radix Sort 基数排序* @param arrdata    INT 数组* @param lensize     数组长度* @return 返回说明*   *   */
void Radixsort(int* arrdata, int lensize);/*** @brief 8 Bucket Sort 桶排序* @param arrdata    INT 数组* @return 返回说明*   *   */
void BucketSort(int* arrdata);/*** @brief 9 Heap Sort 堆排序* @param arrdata    INT 数组* @return 返回说明*    *    */
void HeapSort(int* arrdata, int lensize);/*** @brief 10 Shell Sort 希尔排序* @param arrdata    INT 数组* @param lensize 数组长度* @return 返回说明*    *    */
void ShellSort(int* arrdata, int lensize);#endif //SORTALGORITHM_H

SortAlgorithm.c

/*****************************************************************//*** \file   SortAlgorithm.c* \brief  c Sorting Algorithms 业务操作方法* VSCODE   c11  https://stackoverflow.com/questions/71924077/configuring-task-json-and-launch-json-for-c-in-vs-code* https://www.programiz.com/dsa/counting-sort* https://www.geeksforgeeks.org/sorting-algorithms/* 安装插件“Doxygen Documentation Generator”,用来生成注释。* 安装插件”C/C++ Snippets”,用来生成文件头、代码块分割线等。* \author geovindu,Geovin Du* \date   2023-09-19
***********************************************************************/#include <stdio.h>
#include <stdlib.h>#define MAXSIZE 100/*** @brief 1。Bubble Sort冒泡排序法* @param arrdata    INT 数组* @param lensize   数组长度** @return 排序好的数组*    *    */
int* BubbleSort(int* arrdata,int lensize)
{int i,j,tmp;int* newdate;/* 原始数据 *///int lensize=sizeof(data) / sizeof(data [0]);//sizeof(data); //sizeof(data) / sizeof(data[0]);//printf("2共 長度是:%d ",lensize);printf("冒泡排序法:\n原始数据为:");for (i=0;i<lensize;i++)printf("%3d",arrdata[i]);printf("\n");for (i=(lensize-1);i>=0;i--)     /* 扫描次数 */{for (j=0;j<i;j++)/*比较、交换次数*/{if (arrdata[j]>arrdata[j+1])   /* 比较相邻两数,如第一个数较大则交换 */{tmp=arrdata[j];arrdata[j]=arrdata[j+1];arrdata[j+1]=tmp;}}printf("第 %d 次排序后的结果是:",lensize-i); /*把各次扫描后的结果打印出来*/for (j=0;j<lensize;j++)printf("%3d",arrdata[j]);printf("\n");}//printf("最终排序的结果为:");for (i=0;i<lensize;i++)//newdate[i]=data[i];printf("%3d",arrdata[i]);printf("\n");return arrdata;}void swap(int *a,int *b) //交換兩個變數
{int temp = *a;*a = *b;*b = temp;
}/*** @brief 2 C Program for Selection Sort 选择排序* @param arrdata    INT 数组* @param size   数组长度** @return 返回说明*     -<em>false</em> fail*     -<em>true</em> succeedS*/
void SelectionSort(int* arrdata, int len)
{int i,j;for (i = 0 ; i < len - 1 ; i++){int min = i;for (j = i + 1; j < len; j++)     //走訪未排序的元素if (arrdata[j] < arrdata[min])    //找到目前最小值min = j;    //紀錄最小值swap(&arrdata[min], &arrdata[i]);    //做交換}}/*** @brief 3 Insertion Sort插入排序* @param arrdata    INT 数组int arrdata[]* @param size   数组长度** @return 返回说明*   *    */void InsertionSort(int* arrdata, int size){// defining some iterables and variablesint i, temp, j;// using the for-loopfor (i = 1; i < size; i++){// initializing the temp variable as value at index i from arraytemp = arrdata[i];// initializing another iterable valuej = i - 1;// using the while loop for j >= 0 and arr[j] > tempwhile (j >= 0 && arrdata[j] > temp){// swapping the elementsarrdata[j + 1] = arrdata[j];j = j - 1;}arrdata[j + 1] = temp;}
}void qswap(int* a, int* b)
{int t = *a;*a = *b;*b = t;
}int partition(int arrdata[], int low, int high)
{// Choosing the pivotint pivot = arrdata[high];// Index of smaller element and indicates// the right position of pivot found so farint qi = (low - 1);for (int j = low; j <= high - 1; j++) {// If current element is smaller than the pivotif (arrdata[j] < pivot) {           qi++;qswap(&arrdata[qi], &arrdata[j]);}}qswap(&arrdata[qi + 1], &arrdata[high]);return (qi + 1);
}/*** @brief 4 Quick Sort 快速排序* @param arrdata    INT 数组int arrdata[]* @param low   数组长度开始值* @param high     数组长度结束值* @return 返回说明*   *   */
void QuickSort(int* arrdata, int low, int high){if (low < high) {// pi is partitioning index, arr[p]// is now at right placeint pi = partition(arrdata, low, high);// Separately sort elements before// partition and after partitionQuickSort(arrdata, low, pi - 1);QuickSort(arrdata, pi + 1, high);}
}void merge(int array[], int const left, int const mid,int const right)
{int const subArrayOne = mid - left + 1;int const subArrayTwo = right - mid;// Create temp arraysint* leftArray =(int*)malloc(subArrayOne);// int [subArrayOne];int* rightArray = (int*)malloc(subArrayTwo);//int [subArrayTwo];// Copy data to temp arrays leftArray[] and rightArray[]for (int i = 0; i < subArrayOne; i++)leftArray[i] = array[left + i];for (int j = 0; j < subArrayTwo; j++)rightArray[j] = array[mid + 1 + j];int indexOfSubArrayOne = 0;int indexOfSubArrayTwo = 0;int indexOfMergedArray = left;// Merge the temp arrays back into array[left..right]while (indexOfSubArrayOne < subArrayOne&& indexOfSubArrayTwo < subArrayTwo) {if (leftArray[indexOfSubArrayOne]<= rightArray[indexOfSubArrayTwo]) {array[indexOfMergedArray]= leftArray[indexOfSubArrayOne];indexOfSubArrayOne++;}else {array[indexOfMergedArray]= rightArray[indexOfSubArrayTwo];indexOfSubArrayTwo++;}indexOfMergedArray++;}// Copy the remaining elements of// left[], if there are anywhile (indexOfSubArrayOne < subArrayOne) {array[indexOfMergedArray]= leftArray[indexOfSubArrayOne];indexOfSubArrayOne++;indexOfMergedArray++;}// Copy the remaining elements of// right[], if there are anywhile (indexOfSubArrayTwo < subArrayTwo) {array[indexOfMergedArray]= rightArray[indexOfSubArrayTwo];indexOfSubArrayTwo++;indexOfMergedArray++;}//delete[] leftArray;//delete[] rightArray;
}/*** @brief 5 Merge Sort 合并/归并排序* @param arrdata    INT 数组* @param start   数组长度开始值* @param end     数组长度结束值* @return 返回说明*    *    */
void MergeSort(int* arrdata, int const begin, int const end)
{if (begin >= end)return;int mid = begin + (end - begin) / 2;MergeSort(arrdata, begin, mid);MergeSort(arrdata, mid + 1, end);merge(arrdata, begin, mid, end);
}/*** @brief 6 Counting Sort 计数排序* @param arrdata    INT 数组* @param size   数组长度* @return 返回说明*    *    */
void CountingSort(int* arrdata, int size) {int output[10];// Find the largest element of the arrayint max = arrdata[0];for (int i = 1; i < size; i++) {if (arrdata[i] > max)max = arrdata[i];}// The size of count must be at least (max+1) but// we cannot declare it as int count(max+1) in C as// it does not support dynamic memory allocation.// So, its size is provided statically.int count[10];// Initialize count array with all zeros.for (int i = 0; i <= max; ++i) {count[i] = 0;}// Store the count of each elementfor (int i = 0; i < size; i++) {count[arrdata[i]]++;}// Store the cummulative count of each arrayfor (int i = 1; i <= max; i++) {count[i] += count[i - 1];}// Find the index of each element of the original array in count array, and// place the elements in output arrayfor (int i = size - 1; i >= 0; i--) {output[count[arrdata[i]] - 1] = arrdata[i];count[arrdata[i]]--;}// Copy the sorted elements into original arrayfor (int i = 0; i < size; i++) {arrdata[i] = output[i];}
}int getMax(int array[], int n) {int max = array[0];for (int i = 1; i < n; i++)if (array[i] > max)max = array[i];return max;
}void radcountingSort(int array[], int size, int place) {int output[size + 1];int max = (array[0] / place) % 10;for (int i = 1; i < size; i++) {if (((array[i] / place) % 10) > max)max = array[i];}int count[max + 1];for (int i = 0; i < max; ++i)count[i] = 0;// Calculate count of elementsfor (int i = 0; i < size; i++)count[(array[i] / place) % 10]++;// Calculate cumulative countfor (int i = 1; i < 10; i++)count[i] += count[i - 1];// Place the elements in sorted orderfor (int i = size - 1; i >= 0; i--) {output[count[(array[i] / place) % 10] - 1] = array[i];count[(array[i] / place) % 10]--;}for (int i = 0; i < size; i++)array[i] = output[i];
}/*** @brief 7 Radix Sort 基数排序* @param arrdata    INT 数组* @param size   数组长度* @return 返回说明*    *   */
void Radixsort(int* arrdata, int size) {// Get maximum elementint max = getMax(arrdata, size);// Apply counting sort to sort elements based on place value.for (int place = 1; max / place > 0; place *= 10)radcountingSort(arrdata, size, place);
}//这个数是有规则的
#define NARRAY 9   // Array size 7
#define NBUCKET 8  // Number of buckets  6
#define INTERVAL 12  // Each bucket capacity  10struct Node {int data;struct Node *next;
};struct Node *BucketInsertionSort(struct Node *list);
//void printBuckets(struct Node *list);int getBucketIndex(int value);/*** @brief 8 Radix Sort 基数排序* @param arrdata    INT 数组* @return 返回说明*     -<em>false</em> fail*     -<em>true</em> succeed*/
void BucketSort(int* arrdata) {int i, j;struct Node **buckets;// Create buckets and allocate memory sizebuckets = (struct Node **)malloc(sizeof(struct Node *) * NBUCKET);// Initialize empty bucketsfor (i = 0; i < NBUCKET; ++i) {buckets[i] = NULL;}// Fill the buckets with respective elementsfor (i = 0; i < NARRAY; ++i) {struct Node *current;int pos = getBucketIndex(arrdata[i]);current = (struct Node *)malloc(sizeof(struct Node));current->data = arrdata[i];current->next = buckets[pos];buckets[pos] = current;}// Print the buckets along with their elements//for (i = 0; i < NBUCKET; i++) {//printf("Bucket[%d]: ", i);//printBuckets(buckets[i]);//printf("\n");//}// Sort the elements of each bucketfor (i = 0; i < NBUCKET; ++i) {buckets[i] = BucketInsertionSort(buckets[i]);}//printf("-------------\n");//printf("Bucktets after sorting\n");// for (i = 0; i < NBUCKET; i++) {//printf("Bucket[%d]: ", i);//printBuckets(buckets[i]);//printf("\n");// }// Put sorted elements on arrfor (j = 0, i = 0; i < NBUCKET; ++i) {struct Node *node;node = buckets[i];while (node) {arrdata[j++] = node->data;node = node->next;}}return;
}struct Node* BucketInsertionSort(struct Node *list) {struct Node *k, *nodeList;if (list == 0 || list->next == 0) {return list;}nodeList = list;k = list->next;nodeList->next = 0;while (k != 0) {struct Node *ptr;if (nodeList->data > k->data) {struct Node *tmp;tmp = k;k = k->next;tmp->next = nodeList;nodeList = tmp;continue;}for (ptr = nodeList; ptr->next != 0; ptr = ptr->next) {if (ptr->next->data > k->data)break;}if (ptr->next != 0) {struct Node *tmp;tmp = k;k = k->next;tmp->next = ptr->next;ptr->next = tmp;continue;} else {ptr->next = k;k = k->next;ptr->next->next = 0;continue;}}return nodeList;
}int getBucketIndex(int value) {return value / INTERVAL;
}void printBuckets(struct Node *list) {struct Node *cur = list;while (cur) {printf("%d ", cur->data);cur = cur->next;}
}void heapify(int arr[], int n, int i) {// Find largest among root, left child and right childint largest = i;int left = 2 * i + 1;int right = 2 * i + 2;if (left < n && arr[left] > arr[largest])largest = left;if (right < n && arr[right] > arr[largest])largest = right;// Swap and continue heapifying if root is not largestif (largest != i) {swap(&arr[i], &arr[largest]);heapify(arr, n, largest);}}/*** @brief 9 Heap Sort 堆排序* @param arrdata    INT 数组* @return 返回说明*   *   */
void HeapSort(int* arrdata, int n) {// Build max heapfor (int i = n / 2 - 1; i >= 0; i--)heapify(arrdata, n, i);// Heap sortfor (int i = n - 1; i >= 0; i--) {swap(&arrdata[0], &arrdata[i]);// Heapify root element to get highest element at root againheapify(arrdata, i, 0);}
}/*** @brief 10 Shell Sort 希尔排序* @param arrdata    INT 数组* @param n 数组长度* @return 返回说明*   *    */
void ShellSort(int* arrdata, int n) {// Rearrange elements at each n/2, n/4, n/8, ... intervalsfor (int gap = n/2; gap > 0; gap /= 2){// Do a gapped insertion sort for this gap size.// The first gap elements a[0..gap-1] are already in gapped order// keep adding one more element until the entire array is// gap sortedfor (int i = gap; i < n; i += 1){// add a[i] to the elements that have been gap sorted// save a[i] in temp and make a hole at position iint temp = arrdata[i];// shift earlier gap-sorted elements up until the correct// location for a[i] is foundint j;          for (j = i; j >= gap && arrdata[j - gap] > temp; j -= gap)arrdata[j] = arrdata[j - gap];//  put temp (the original a[i]) in its correct locationarrdata[j] = temp;}}/*for (int interval = n / 2; interval > 0; interval /= 2) {for (int i = interval; i < n; i += 1) {int temp = array[i];int j;for (j = i; j >= interval && array[j - interval] > temp; j -= interval) {array[j] = array[j - interval];}array[j] = temp;}}*/
}

调用:

/** @Author: 涂聚文 geovindu,Geovin Du* @Date: 2023-09-11 14:07:29* @LastEditors:* @LastEditTime: 2023-09-20 14:35:49* @FilePath: \testcpp\helloword.c* @Description:*/
/*****************************************************************//*** \file   helloworld.C* \brief  业务操作方法* VSCODE   c11         安装插件“Doxygen Documentation Generator”,用来生成注释。安装插件”C/C++ Snippets”,用来生成文件头、代码块分割线等。KoroFileHeaderC/C++ Snippets插件设置* \author geovindu,Geovin Du* \date   2023-09-19
***********************************************************************/#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include "include/SortAlgorithm.h"int main()
{printf("hello world, c \n");printf("你好,中国\n");int i;int *p;  char str[20];//1冒泡排序int data[12]={60,50,39,27,12,8,45,63,20,2,10,88};   /* 原始数据 */int lensize=sizeof(data) / sizeof(data [0]);//sizeof(data);p=BubbleSort(data,lensize);//itoa(lensize, str, 10);//printf("1共長度是 %d ",lensize);printf("\n1冒泡排序的结果为:");for (i=0;i<lensize;i++)printf("%3d",p[i]);printf("\n");//2选择排序int arr[] = { 64, 25, 12, 22, 11,88,28,100 };int n = sizeof(arr) / sizeof(arr[0]);selectionSort(arr, n);int ii;printf("2选择排序结果为:");for(ii = 0; ii < n; ii++)printf("%d ", arr[ii]);printf("\n");//3插入排序int inarr[] = {25, 23, 28, 16, 18,100,8,99}; // calculating the size of array int size = sizeof(inarr) / sizeof(inarr[0]); printf("3插入排序结果为:");InsertionSort(inarr, size); for(ii = 0; ii < n; ii++)printf("%d ", inarr[ii]);printf("\n");//4快速排序// defining and initializing an array int qsarr[] = {100,25, 23, 28, 16, 18,8,99,3,20};printf("4快速排序结果为:");// calculating the size of array size = sizeof(qsarr) / sizeof(qsarr[0]); QuickSort(qsarr, 0, size - 1); for (int i = 0; i < size; i++)printf("%d ", qsarr[i]);printf("\n");//5 合并排序printf("5合并排序结果为:");int mearr[] = { 12, 11, 23, 55, 6, 57,3,100,9 };int arr_size = sizeof(mearr) / sizeof(mearr[0]);MergeSort(mearr, 0, arr_size - 1);for (int i = 0; i < arr_size; i++)printf("%d ", mearr[i]);printf("\n");//6 计数排序printf("6计数排序结果为:");int carray[] = {4, 2, 2, 8, 3, 3, 1};int cn = sizeof(carray) / sizeof(carray[0]);CountingSort(carray, cn);for (int i = 0; i < cn; i++)printf("%d ", carray[i]);printf("\n");//7. 基数排序printf("7基数排序结果为:");int rarray[] = {121, 432, 564, 23, 1, 45, 788};int rn = sizeof(rarray) / sizeof(rarray[0]);Radixsort(rarray, rn);for (int i = 0; i < rn; i++)printf("%d ", rarray[i]);printf("\n");//8 Bucket Sort 桶排序printf("8桶排序结果为:");int barray[] = {42, 32, 33, 5,52, 37,100, 47, 51};BucketSort(barray);int bn = sizeof(barray) / sizeof(barray[0]);for (int i = 0; i < bn; i++)printf("%d ", barray[i]);printf("\n");//9堆排序printf("9堆排序结果为:");int harr[] = {1, 12, 9, 5, 6, 10};int hn = sizeof(harr) / sizeof(harr[0]); HeapSort(harr, hn);for (int i = 0; i < hn; i++)printf("%d ", harr[i]);printf("\n");//10.希尔排序printf("10.希尔排序结果为:");int sdata[] = {9, 8, 3, 7, 25, 6, 4, 11,38};int ssize = sizeof(sdata) / sizeof(sdata[0]);ShellSort(sdata, ssize);for (int i = 0; i < ssize; i++)printf("%d ", sdata[i]);printf("\n");//system("pause");  liunx 无效,win 下使用return 0;}

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

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

相关文章

35.肥皂泡动画效果

特效 源码 index.html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Animated Soap Bubbles</title> <link rel="stylesheet" typ…

ubuntu 22.04 服务器网卡无IP地址

ssh连接服务器连接不上&#xff0c;提示如下&#xff1b; 连接显示器&#xff0c;ip addr ls 命令查看IP地址&#xff0c;有网卡但没有IP地址 solution&#xff1a; sudo dhclient enp10s0用于通过 DHCP 协议获取网络配置信息并为名为 enp10s0 的网络接口分配 IP 地址,enp1…

【C++】AVL树

AVL树 1. AVL树的概念2. AVL树的实现2.1 节点的定义2.2 插入2.3 是否是AVL树 3. AVL树与红黑树 1. AVL树的概念 AVL树是一棵二叉搜索树&#xff0c;但它的每个节点的左右子树的高度差的绝对值不超过1&#xff0c;且它的子树也是平衡二叉树。左右子树的高度差也叫平衡因子&…

爬虫 — App 爬虫(二)

目录 一、Appium介绍二、node.js 安装三、Java 的 SDK 安装以及配置1、安装步骤2、配置环境变量 四、安卓环境的配置1、配置环境变量 五、Appium 安装1、安装2、打开 APP3、使用 六、Appium 使用1、定位数据&#xff08;方法一&#xff0c;不常用&#xff09;2、定位数据&#…

磁盘检测工具DiskInfo下载

网址&#xff1a;Download - Crystal Dew World [en] (crystalmark.info) PS:乍一看还以为是什么二次元网站 划到这里&#xff0c;下载zip 等待一会就会自动弹出下载了 选择合适的位置即可

token登录的实现

token登录的实现 我这种token只是简单的实现token&#xff0c;就是后端利用UUID 生成简单随机码&#xff0c;利用随机码作为在Redis中的键&#xff0c;然后存储的用户信息作为值&#xff0c;在每次合理请求的时候对token的有效时间进行刷新&#xff08;利用拦截器&#xff09;&…

FPGA project : DS18B20

本想着一天发一个实验的&#xff0c;这个ds18b20&#xff0c;耗时两天。代码写了两次&#xff0c;呜呜~ 由于第二次写代码没画时序图&#xff0c;所以代码和时序图一些参数有些不一致&#xff0c;但问题不大。 这里有几件事情值得一提&#xff1a; 1&#xff1a;关于状态机的…

ceph分布式存储

ceph特点 Ceph项目最早起源于Sage就读博士期间的工作&#xff08;最早的成果于2004年发表&#xff09;&#xff0c;并随后贡献给开源社区。在经过了数年的发展之后&#xff0c;目前已得到众多云计算厂商的支持并被广泛应用。RedHat及OpenStack都可与Ceph整合以支持虚拟机镜像的…

【C语言】求一个整数的二进制序列中1的个数的三种方法

方法一&#xff1a;逐位%2法 该方法的初步测试代码如下: int NumberOf1(int n) {int count 0;while (n){if (n % 2 1){count;}n n / 2;}return count; } 众所周知&#xff0c;数据在内存里以补码的形式存储&#xff0c;这是为了简化计算机的结构设计&#xff0c;同时也提…

【数据结构】哈希表(详)

文章目录 前言正文一、基本概念二、基本原理1.哈希函数1.1直接定址法&#xff08;常用&#xff09;1.2除留余数法&#xff08;常用&#xff09;1.3 平方取中法&#xff08;了解&#xff09;1.4 折叠法(了解)1.5 随机数法(了解)1.6数学分析法(了解) 2.哈希冲突2.1 平均查找长度2…

Python —— excel文件操作(超详细)

背景 很多公司还是用excel去管理测试用例的&#xff0c;所以为了减少重复繁琐的导出导出工作&#xff0c;学会如何用代码操作excel表格很实用~ 1、读取excel文件基本步骤 1、操作excel的一些库 1、xlrd&#xff1a;读取库&#xff0c;xlwt&#xff1a;写入&#xff0c;现在…

No servers available for service: renren…。 Gateway 网关报503错误 ,已解决

目录 环境配置问题描述loadbalancer的作用 环境配置 问题描述 配置spring cloud gateway使用端口访问就可以&#xff0c;使用lb:// 就报503 gateway:routes:- id: admin_routeuri: lb://gulimall-admin # uri: http://localhost:8080predicates:- Path/api/**filter…

蓝桥杯 题库 简单 每日十题 day7

01 啤酒和饮料 题目描述 本题为填空题&#xff0c;只需要算出结果后&#xff0c;在代码中使用输出语句将所填结果输出即可。啤酒每罐2.3元&#xff0c;饮料每罐1.9元。小明买了若干啤酒和饮料&#xff0c;一共花了82.3元。我们还知道他买的啤酒比饮料的数量少&#xff0c;请你…

CVPR 2023 | UniMatch: 重新审视半监督语义分割中的强弱一致性

在这里和大家分享一下我们被CVPR 2023录用的工作"Revisiting Weak-to-Strong Consistency in Semi-Supervised Semantic Segmentation"。在本工作中&#xff0c;我们重新审视了半监督语义分割中的“强弱一致性”方法。我们首先发现&#xff0c;最基本的约束强弱一致性…

RHCE---时间服务器

文章目录 前言一、pandas是什么&#xff1f;二、使用步骤 1.引入库2.读入数据总结 前言 Linux中的时间服务器是指NTP服务器&#xff0c;NTP是Network Time Protocol的缩写&#xff0c;即网络时间协议。NTP服务器可以提供精确的时间信息&#xff0c;从而使得网络上的所有设备都能…

C语言文件的相关操作

C语言中文件的相关操作 文件的打开 使用文件的打开函数需要引入这个头文件&#xff1a;#include <fcntl.h> open函数 int open(char const *pathname, int flags, mode_t mode) 功能&#xff1a;打开已有的文件或者创建新文件参数 pathname&#xff1a;文件路径名&…

基于Python+Tkinter实现一个贪食蛇小游戏

你是否还记得那个时代&#xff0c;当我们的手机还没有触摸屏&#xff0c;游戏也只有像“贪食蛇”这样的经典款&#xff1f;当时&#xff0c;许多人都沉迷于控制一条小蛇吃食物的乐趣中。而今&#xff0c;让我们利用Python和Tkinter&#xff0c;一起重温那个时代&#xff0c;制作…

C语言基础知识点(八)联合体和大小端模式

以下程序的输出是&#xff08;&#xff09; union myun {struct { int x, y, z;} u;int k; } a; int main() {a.u.x 4;a.u.y 5;a.u.z 6;a.k 0;printf("%d\n", a.u.x); } 小端模式 数据的低位放在低地址空间&#xff0c;数据的高位放在高地址空间 简记&#xff…

使用Java将PPT、PPTX和PDF转换为图片

从Office到图片—使用Java实现文件格式转换 PDF转图片1. 万事第一步2. 撸代码 PPT/PPTX转图片1. 万事第一步2. 撸代码验收一下 最近小雨遇到了一个需求&#xff0c;需要在前端小程序中嵌入展示Office文件的功能。然而&#xff0c;前端使用开源组件进行在线预览会导致性能消耗较…

R语言贝叶斯广义线性混合(多层次/水平/嵌套)模型GLMM、逻辑回归分析教育留级影响因素数据...

全文下载链接&#xff1a;http://tecdat.cn/?p24203 本教程使用R介绍了具有非信息先验的贝叶斯 GLM&#xff08;广义线性模型&#xff09; &#xff08;点击文末“阅读原文”获取完整代码数据&#xff09;。 当前教程特别关注贝叶斯逻辑回归在二元结果和计数/比例结果场景中的…