3月5日笔记
3月5日学习 一、算法学习 1、归并排序 2、堆排序 一、算法学习 1、归并排序 代码 : # include <iostream> # include <string> # include <cstring> # include <algorithm> # include <memory> # include <functional> using namespace std ; void merge ( int a [ ] , int l , int mid , int r ) { //cout<<"l:"<<l<<endl; //cout<<"r:"<<r<<endl; //cout<<"mid:"<<mid<<endl; int help [ 100 ] ; int p1 = l ; int p2 = mid + 1 ; int i = 0 ; while ( p1 <= mid && p2 <= r ) { if ( a [ p1 ] <= a [ p2 ] ) { help [ i ++ ] = a [ p1 ++ ] ; } else { help [ i ++ ] = a [ p2 ++ ] ; } } while ( p1 <= mid ) { help [ i ++ ] = a [ p1 ++ ] ; } while ( p2 <= r ) { help [ i