Error Party
  • 홈
    • 분류 전체보기
      • IT
      • 이슈
      • 애니
  • 글작성
  • 방명록
  • 환경설정
  • 메뉴 닫기
CPU-Architecture. 검색 결과
1 개의 검색 결과가 있습니다.
IT

정렬 된 배열을 정렬되지 않은 배열을 처리하는 것보다 빨리 처리하는 이유는 무엇입니까?

질문다음은 매우 특이한 행동을 보여주는 C ++ 코드 조각입니다.이상한 이유로, 데이터를 기적적으로 루프를 거의 6 배 더 빨리 분류합니다.#include #include #include int main() { // Generate data const unsigned arraySize = 32768; int data[arraySize]; for (unsigned c = 0; c < arraySize; ++c) data[c] = std::rand() % 256; // !!! With this, the next loop runs faster. std::sort(data, data + arraySize); // Test clock_t start = clock(); long long sum = 0; for (u..

2022. 3. 23. 10:35
  • «
  • 1
  • »
  • 최근 글

최근 글

최근댓글

전체 카테고리

  • 분류 전체보기
    • IT
    • 이슈
    • 애니
Powered by Privatenote Copyright © Error Party All rights reserved. TistoryWhaleSkin3.4

티스토리툴바