Fenwick_tree_cay_chi_so_nhi_phan.pdf

162 1 0
Fenwick_tree_cay_chi_so_nhi_phan.pdf

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

cấu trúc cây chỉ số nhị phân, tài liệu về cây chỉ số nhị phân

Fenwick Tree (Binary Indexed Tree) William Fiset Outline • • • Discussion & Examples • Data structure motivation • What is a Fenwick tree? • Complexity analysis Implementation details • Range query • Point Updates • Fenwick tree construction Code Implementation Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 Sum of A from [2,7) = + + + -4 + 11 = 14 Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 Sum of A from [2,7) = + + + -4 + 11 = 14 Sum of A from [0,4) = + -3 + + = Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 Sum of A from [2,7) = + + + -4 + 11 = 14 Sum of A from [0,4) = + -3 + + = Sum of A from [7,8) = = Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 P = ∅ ∅ ∅ ∅ ∅ ∅ ∅ ∅ ∅ ∅ Let P be an array containing all the prefix sums of A ∅ Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 P = ∅ ∅ ∅ ∅ ∅ ∅ ∅ ∅ ∅ Let P be an array containing all the prefix sums of A ∅ Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 P = ∅ ∅ ∅ ∅ ∅ ∅ ∅ ∅ Let P be an array containing all the prefix sums of A ∅ Fenwick Tree Motivation Given an array of integer values compute the range sum between index [i, j) A = -3 -4 11 P = ∅ ∅ ∅ ∅ ∅ ∅ ∅ Let P be an array containing all the prefix sums of A ∅

Ngày đăng: 04/02/2024, 12:45

Tài liệu cùng người dùng

Tài liệu liên quan