[ Divide and Conquer ] Matrix Multiplication & Karatsuba Algorithm

2024. 12. 5. 01:33·CS/Algorithm
728x90
반응형

Matrix Multiplication

  • Multiply 2 N by N Matrices
  • Takes O(\(N^3\)) Time using Normal Method -> Let's consider only number multiplication

Apply Divide and Conquer

지금 A, B, C, D 이것들이 전부 N/2 by N/2 Matrix 들이다.

이러한 행렬들을 위의 공식으로 계산하면 결국 N by N 행렬을 곱한 것과 같다.

결국 이는 O(N^3)이다.

 

Strassen's Algorithm

곱하기 갯수에 집중해서 생각해보자

곱하기가 7번뿐이다. 대신 덧셈과 뺄셈이 늘어났다

곱셈이 줄어들기 때문에, O(2^log7N)이 된다. 

 

Karatsuba Algorithm 

n x n 자리수를 곱하는 것

O(n^2) 시간이 걸린다. 

 

자리수를 divide and concur 하자

n = 2m 이라면, \(x \times y = (x_1 10^m + x_0) (y_1 10^m + y_0)\)

 

728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'CS > Algorithm' 카테고리의 다른 글

[Dynamic Programming] Working Days & Path Counting & Matrix Chain Multiplication  (0) 2024.12.09
[Dynamic Programming] Maximum Subarray & Floyd Warshall Alg  (0) 2024.12.09
[ Divide and Conquer ] Farthest Point  (3) 2024.12.04
[ Divide and Conquer ] Convex Hull  (1) 2024.10.23
[ Divide and Conquer ] Closest Pair  (3) 2024.10.21
'CS/Algorithm' 카테고리의 다른 글
  • [Dynamic Programming] Working Days & Path Counting & Matrix Chain Multiplication
  • [Dynamic Programming] Maximum Subarray & Floyd Warshall Alg
  • [ Divide and Conquer ] Farthest Point
  • [ Divide and Conquer ] Convex Hull
min_zu
min_zu
  • min_zu
    민주제도
    min_zu
  • 전체
    오늘
    어제
    • ._. (176)
      • AI (2)
        • DeepLearning (2)
        • CS231n (0)
      • Web (2)
        • ReactJS (0)
      • CS (83)
        • OS (7)
        • Data Structure (23)
        • Computer Architecture (8)
        • Computer Network (20)
        • Algorithm (25)
      • Linux (3)
        • KaliLinux (0)
        • Docker (1)
      • Hacking (83)
        • Write Up (25)
        • Pwnable (13)
        • Reversing (2)
        • Cryptography (12)
        • Web Hacking (4)
        • Window (6)
        • Network (7)
        • Web3 (13)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    Search
    Tree
    Linux
    WinAFL
    Web
    DataStructure
    AI
    Sort
    OS
    Graph
    UTM
    Mac
    ComputerArchitecture
    DeepLearning
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
min_zu
[ Divide and Conquer ] Matrix Multiplication & Karatsuba Algorithm
상단으로

티스토리툴바