# 数据结构及算法基础 **Repository Path**: ken2105/algorithms_basic ## Basic Information - **Project Name**: 数据结构及算法基础 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-01-29 - **Last Updated**: 2023-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 介绍 数据结构及算法练习题 ## 目录 | 程序 | 说明 | 备注 | | ---------------------------- | ----------------------------- | ------ | | class01/Code01_SelectionSort | 选择排序 | | | class01/Code02_BubbleSort | 冒泡排序 | | | class01/Code03_InsertionSort | 插入排序 | | | class01/Code04_BSExist | 在有序数组中,是否存在一个数 | 二分法 | | class01/Code05_BSNearLeft | 有序数组中找到>=num最左的位置 | 二分法 | | class01/Code06_BSNearRight | 有序数组中找到<=num最右的位置 | 二分法 | | class01/Code07_BSAwesome | 局部最小值问题 | 二分法 | | class01/Code08_OneOddOtherEven | 一个数组中有一种数出现了奇数次 | 位运算 | | class01/Code09_TwoOddOtherEven | 一个数组中有两种数出现了奇数次 | 位运算 | | class01/Code10_KM | 一个数组中有一种数出现K次,其他数都出现了M次 | 位运算 | ## 位运算 |运算符|说明|运算规则| | --- | --- | --- | | & | 与运算 | 0&0=0; 0&1=0; 1&0=0; 1&1=1; | | | | 与运算 | 0|0=0; 0|1=1; 1|0=1; 1|1=1; | | ^ | 异或运算 | 0^0=0; 0^1=1; 1^0=1; 1^1=0; | ### 获取int数字最后一位1 ``` a = 0001010100100101101000 ~a = 1110101011011010010111 ~a+1 = 1110101011011010011000 ans = 0000000000000000001000 ans = a & (~a + 1) ans = a & (-a) ```