옳은 길로 바르게

  • 홈
  • 태그
  • 방명록

Programming Language/cpp 3

mergeSort

Time ComplexityO(n log n)Code#include #include using namespace std;void merge(vector& vec, int left, int mid, int right){ int i,j,k; int fIdx = mid - left + 1; int sIdx = right - mid; vector leftVc(fIdx), rightVc(sIdx); for(i=0; i& vec, int left, int right){ if (left

Programming Language/cpp 2025.10.13

Is ++i better than i++?

Assuming that prefix and postfix operations perform the same computation,++i is generally more efficient than i++ in terms of cost.Since i++ requires storing the original value in a temporary register, ++i is slightly cheaper.++i add rax, 1 ; i = i + 1i++ mov rcx, rax ; old = i (temporary value) add rax, 1 ; i = i + 1 (original value)

Programming Language/cpp 2025.10.11

std::array vs std::vector

해당 포스트는 cppreference.com을 참조해 작성했습니다. std::arraya container that encapsulates fixed size arrays.it doesn't decay to T* automatically.template struct array;std::vectora sequence container that encapsualteds dynamic size arrays.Except for std::vector partial specialization, the element are stored contiguously, which means that elements can be accessed not only through iterators, but also using off..

Programming Language/cpp 2025.10.10
이전
1
다음
더보기
프로필사진

옳은 길로 바르게

sgwin 님의 블로그 입니다.

  • 분류 전체보기 (5)
    • Programming Language (3)
      • cpp (3)
    • Algorithm & PS (2)
      • Algorithm (2)
    • AI & ML (0)
      • Papers (0)

Tag

binarySearch in Cpp, binarysearch, C++ algorithm, cpp algorithm, prefix, C++, binarySearch in C++, postfix, CPP, register cost,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/12   »
일 월 화 수 목 금 토
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바