How to sort vector in C++, 벡터 정렬하는 방법,sorting,배열,stl,씨쁠쁠,example code,예제코드,표준라이브러리
벡터 오름차순, 내림차순 정렬 방법 (STL)
Vector sorting descending, ascending
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main(int argc, char*(*argv))
{
vector<int> sampleVector1 = { 6,2,6,3,7,2,1,9,123,42,7,645,185 };
vector<int> sampleVector2 = { 6,2,6,3,7,2,1,9,123,42,7,645,185 };
// ascending
sort(sampleVector1.begin(), sampleVector1.end());
// descending
sort(sampleVector2.begin(), sampleVector2.end(), greater<int>());
for (auto x : sampleVector1)
cout << x << " ";
cout << endl << endl;
for (auto x : sampleVector2)
cout << x << " ";
cout << endl << endl;
return 0;
}
2019/04/02 - [Programming/C++] - How to find if vector contains specific value or not in C++, 씨쁠쁠 stl 벡터에 특정 값이 이미 있는지 확인하는 방법
2019/02/12 - [Programming/C++] - How to use map in c++ STL, c++ 맵 STL 사용방법/초기화/예제, java, example, sample, library, find, insert, first
2019/02/04 - [Programming/C++] - How to add DLL / external lib file to VisualStudio, 비주얼스튜디오 외부라이브러리 dll 파일 추가 방법, example, c++ java api
2018/12/26 - [Programming/Software Architecture] - Perfecting OO's Small Classes and Short Methods. 완벽한 객체지향의 작은 클래스와 짧은 메소드, Book:ThoughtWorks Anthology, Java,cpp,자바,oop,좋은코드,객체지향프로그래밍
2018/11/28 - [Programming/Image Processing] - OpenCV How to get min/max value from matrix, 매트릭스 최소값/최대값. Java,c++,cpp,imageprocessing
2019/09/03 - [Algorithm/Leet Code] - LeetCode #1046 LastStoneWeight. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접,연결리..
2019/09/01 - [Algorithm/Leet Code] - LeetCode #463 IslandPerimeter. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접,연결리스..
2019/08/28 - [Algorithm/Leet Code] - LeetCode #821 ShortestDistanceToACharacter. Algorithm,알고리즘,LeetCode,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive,datastructure,techinterview,coding,코딩인터뷰,기술면접..
2019/01/12 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #60 sudoku. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive
2019/01/12 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #59 spiralNumbers. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive
2019/01/08 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #58 messageFromBinaryCode. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive
2019/01/07 - [Algorithm/Code Fights (Code Signal)] - Aracade Intro #57 fileNaming. Algorithm,알고리즘,Codefights,CodeSignal,코드파이트,코드시그널,예제,문제해결능력,example,c++,java,재귀,recursive