摘要:
//冒泡排序,一句话概括:从前往后遍历,如果a[j-1] > a[j],则交换位置,将最大值放到最后。 void bubble_sort(vector<int>& nums, int n) { if (n <= 1) return; bool flag = false; for (int i = 1 阅读全文
摘要:
//快速排序,递归操作,先找到枢纽,将所有比枢纽小的数放到其左边,将所有比其大的数放到其右边 void QuickSort(vector<int>& nums, int l, int r){ if (l + 1 >= r) return; int x = l, y = r - 1, xnum = n 阅读全文
摘要:
1.简单工厂模式 #include <bits/stdc++.h> using namespace std; class produce { private: int width; int height; public: produce(int width,int height):width(wid 阅读全文
摘要:
#include <bits/stdc++.h> using namespace std; class student { private: char* name; public: student() { name = new char(20); cout << "创建student" << end 阅读全文