게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
심심한데 문제나 풀어봅시다 ㅇㅇ
게시물ID : freeboard_404425짧은주소 복사하기
작성자 : ㅁㅁ
추천 : 1
조회수 : 905회
댓글수 : 4개
등록시간 : 2010/02/18 22:33:58
3.1 Matrix addition
Let A be an N x N matrix initialized by arbitrary values. Suppose that we have to add N
submatrices to A in the following manner:

for k := 1 to N do
  read (R1;R2;C1;C2; V );
  for i := R1 to R2 do
    for j := C1 to C2 do
      A[i][j] := A[i][j] + V ;
    end
  end
end

For each of the submatrix, 1 <= R1 <= R2 <= N, 1 <= C1 <= C2 <= N and V 2 R. Furthermore,
(R1, R2, C1, C2, V ) are di erent from submatrix to submatrix. It is obvious that the above
algorithm takes O(N3) in the worst case. Design an algorithm with better time complexity
while achieving the same task.

걍 숙제하다가 짱나서 올려봄 ㅇㅇㅋ 정답은 O(n^2)
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호