本节重点思维导图 数组 public static void main(String[] args) { int a ; a=3; int[] b; b = new int[3];//强制开辟内存空间 int c[] = new int [8]; int[] d = {3,4,5,67}; int[] e = new int[] {3,4,5}; System.out.println(d[2]); } 例题:产生1到100之间所有奇数组成的数组并输出.要求每10个一行输出 public clas…
''' 选择排序:选择最小的,以此类推 ''' import random import cProfile def select_Sort(nums): for i in range(len(nums)-1): for j in range(i+1,len(nums)): if nums[i] > nums[j]: # max = nums[i] # nums[i] = nums[j] # nums[j] = max #python有更好的写法 nums[i],nums[j] = nums[j]…
选择排序的思想是:每次从待排序中选择最小(大)的元素插入已经排好的序列中. /*直接选择排序*/ #include <iostream> using namespace std; void swapp(int &a,int &b) { int temp = a; a = b; b = temp; } int main() { int a[]={5,4,10,20,12,3,2,1,3,5,6,56,43,32}; int size = sizeof(a)/sizeof(int)…