1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Tài liệu Một số vấn đề khác trong đồ thị pptx

6 471 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Một số vấn đề khác trong đồ thị
Trường học Vietnam National University, Hanoi
Chuyên ngành Information Technology
Thể loại Bài giảng
Thành phố Hanoi
Định dạng
Số trang 6
Dung lượng 229,66 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Landis 2 Comparison to other structures «5 AVL tree ` From Wikipedia, the free encyclopedia Wired: The Free Encyclopedia @ This article is missing citations or needs f

Trang 1

Một sô vân đề khác trong đô thị

(Tự đọc)

Lé SY Vinh

Bộ môn Khoa Học Máy Tính — Khoa CNTT

Dai Hoc Cong Nghé - DHQGHN

vinhioi@yahoo.com

Trang 2

Cây tìm kiêm nhị phân cân bằng

AVL (G.M Adelson-Velsky and E.M Landis)

2 Comparison to other structures

«5 AVL tree

`

From Wikipedia, the free encyclopedia

Wired:

The Free Encyclopedia @ This article is missing citations or needs footnotes

navigation Using inline citations helps guard against copyright violations and factual inaccuracies (October 2007)

» Contents In computer science, an AVL tree is a self-balancing binary search tree, and it is the first such data structure to be

» Featured content invented!" In an AVL tree, the heights of the two child subtrees of any node differ by at most one; therefore, itis also

= Current events said to be height-balanced Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases, ew oN

a Random article where nis the number of nodes in the tree prior to the operation Insertions and deletions may require the tree to be @

fo The AVL tree is named after its two inventors, G.M Adelson-Velsky and E.M Landis, who published it in their 1962 5 @ Z

paper "An algorithm for the organization of information."

interaction The balance factor of a node is the height of its right subtree minus the height of its left subtree and a node with @ đó œ

„ Ahout Wikipedia balance factor 1, 0, or-1 is considered balanced A node with any other balance factor is considered unbalanced and ý

» Community portal requires rebalancing the tree The balance factor is either stored directly at each node or computed from the heights @ é?

» Recent changes of the subtrees

= Donate to Wikipedia AVL trees are often compared with red-black trees because they support the same set of operations and because tree

= Help red-black trees also take O(log n) time for the basic operations AVL trees perform better than red-black trees for

lookup-intensive applications 7! The AVL tree balancing algorithm appears in many computer science curricula 60

= Upload file 1 Operations a a oF V6)

" Special pages 1.1 Insertion (9) 44 (19) 67

Done

Trang 3

Đường đi ngăn nhất giữa mọi cặp đỉnh

Input: Đô thị G = (V, E)

Output: Ma trận Dist[u,v] là đường đi ngắn nhất giữa hai đỉnh u và v

Thuật toán Floyd:

for(u=0;u<n;u+rr)

for(v=0;v<n;vtr)

Dist[u][v] = weight[u][v];

for ( k=0;k<n; k++)

for(u=0;u<n;u+rr)

for(v=0;v<n;vtr)

if (Dist[u][k] + Dist[k][v] < Dist[u][v] )

Dist[u][v] = Dist[u][k] + Dist[k][v]

Trang 4

Cây bao trùm ngăn nhất (minimum spanning tree)

° - Đô thị không hướng G = (V, E), cây bao trùm T là đồ thị con của G, liên thông, không chu trình và nôi tât cả các đỉnh V của G

‹ - Cây bao trùm ngăn nhất là cây có tông độ dài các cạnh ngắn nhất

Trang 5

Cây bao trùm ngăn nhất (minimum spanning tree)

Prim(G,T)

//Xay dựng cây bao trùm ngắn nhất T của đô thị G

{

U = {s}; //Khởi tạo tập U chỉ chưa một đỉnh s

while (U#V )

{

chon (u,v) la canh ngan nhat voiu € U vav e V-U; U=U U fv};

T=TvU {(uv};

j

Ngày đăng: 12/12/2013, 13:15

TỪ KHÓA LIÊN QUAN

w