Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> การเขียนโปรแกรม

The B+ Tree ในโครงสร้างข้อมูล


B+ Trees คืออะไร

B+ Trees เป็น Extended Version ของ B-Trees รองรับ Insert, Delete, Search ดีกว่า B-Tree

ความแตกต่างจาก B-Tree

  • B-Tree: Keys และ Records อยู่ทั้ง Internal และ Leaf Nodes
  • B+ Tree: Records อยู่ Leaf Nodes เท่านั้น Internal Nodes เก็บ Keys เท่านั้น
  • Leaf Nodes ของ B+ Tree เชื่อมเป็น Linked List

ตัวอย่าง

The B+ Tree ในโครงสร้างข้อมูล

ข้อได้เปรียบเหนือ B-Tree

  • Records เรียกได้ด้วย Disk Access เท่ากันทุกครั้ง
  • ความสูงสมดุล และต่ำกว่า B-Tree
  • Leaf เชื่อม Linked List → Sequential Search ได้
  • Keys ใช้สำหรับ Indexing
  • Search เร็วกว่า เพราะ Data อยู่ Leaf Level เท่านั้น