fbpx
วิกิพีเดีย

ต้นไม้เฟนวิก

ในวิทยาการคอมพิวเตอร์ ต้นไม้เฟนวิก (อังกฤษ: Fenwick tree) หรืออาจเรียกว่า binary indexed tree เป็นโครงสร้างข้อมูลที่ใช้ในการคำนวณผลรวมนำหน้า (prefix sum) ของตารางข้อมูลได้อย่างมีประสิทธิภาพ โครงสร้างข้อมูลนี้คิดค้นโดย Peter Fenwick ใน พ.ศ. 2537

การคำนวณผลรวมนำหน้าอย่างง่ายก็คือการสร้างตารางคำนวณผลลัพธ์ล่วงหน้า ซึ่งใช้เวลา ในการดำเนินการ และหลังจากนั้นก็สามารถหาผลลัพธ์จากตารางดังกล่าวได้ในเวลาเพียง อย่างไรก็ตาม หากหลังจากนั้นต้องการที่จะแก้ไขข้อมูลขึ้นมา ก็ต้องคำนวณข้อมูลทั้งตารางใหม่อีกรอบ กล่าวคือหากมีการแก้ข้อมูล รอบ ก็จะทำให้ต้องเสียเวลา ซึ่งเสียเวลาเป็นอย่างมาก ต้นไม้เฟนวิกเข้ามาช่วยลดเวลาในส่วนนี้โดยทำให้การแก้ไขข้อมูลแต่ละครั้งใช้เวลาเพียง ทำให้การแก้ข้อมูล รอบ ใช้เวลาเพียง แต่ก็แลกมากับเวลาในการหาผลลัพธ์ซึ่งเพิ่มขึ้นจาก มาเป็น

อ้างอิง

  1. Peter M. Fenwick (1994). "A new data structure for cumulative frequency tables". Software: Practice and Experience. 24 (3): 327–336. doi:10.1002/spe.4380240306.

แหล่งข้อมูลอื่น

  • A tutorial on Fenwick Trees on TopCoder
  • An article on Fenwick Trees on Algorithmist
  • An entry on Fenwick Trees on Polymath wiki
  • Order-statistics tree, a related data structure

นไม, เฟนว, ในว, ทยาการคอมพ, วเตอร, งกฤษ, fenwick, tree, หร, ออาจเร, ยกว, binary, indexed, tree, เป, นโครงสร, างข, อม, ลท, ใช, ในการคำนวณผลรวมนำหน, prefix, ของตารางข, อม, ลได, อย, างม, ประส, ทธ, ภาพ, โครงสร, างข, อม, ลน, ดค, นโดย, peter, fenwick, ใน, 2537, การค. inwithyakarkhxmphiwetxr tnimefnwik xngkvs Fenwick tree hruxxaceriykwa binary indexed tree epnokhrngsrangkhxmulthiichinkarkhanwnphlrwmnahna prefix sum khxngtarangkhxmulidxyangmiprasiththiphaph okhrngsrangkhxmulnikhidkhnody Peter Fenwick in ph s 2537 1 karkhanwnphlrwmnahnaxyangngaykkhuxkarsrangtarangkhanwnphllphthlwnghna sungichewla O n displaystyle O n inkardaeninkar aelahlngcaknnksamarthhaphllphthcaktarangdngklawidinewlaephiyng O 1 displaystyle O 1 xyangirktam hakhlngcaknntxngkarthicaaekikhkhxmulkhunma ktxngkhanwnkhxmulthngtarangihmxikrxb klawkhuxhakmikaraekkhxmul q displaystyle q rxb kcathaihtxngesiyewla O n q displaystyle O nq sungesiyewlaepnxyangmak tnimefnwikekhamachwyldewlainswnniodythaihkaraekikhkhxmulaetlakhrngichewlaephiyng O log n displaystyle O log n thaihkaraekkhxmul q displaystyle q rxb ichewlaephiyng O q log n displaystyle O q log n aetkaelkmakbewlainkarhaphllphthsungephimkhuncak O 1 displaystyle O 1 maepn O log n displaystyle O log n xangxing aekikh Peter M Fenwick 1994 A new data structure for cumulative frequency tables Software Practice and Experience 24 3 327 336 doi 10 1002 spe 4380240306 aehlngkhxmulxun aekikhA tutorial on Fenwick Trees on TopCoder An article on Fenwick Trees on Algorithmist An entry on Fenwick Trees on Polymath wiki Order statistics tree a related data structureekhathungcak https th wikipedia org w index php title tnimefnwik amp oldid 4714731, wikipedia, วิกิ หนังสือ, หนังสือ, ห้องสมุด,

บทความ

, อ่าน, ดาวน์โหลด, ฟรี, ดาวน์โหลดฟรี, mp3, วิดีโอ, mp4, 3gp, jpg, jpeg, gif, png, รูปภาพ, เพลง, เพลง, หนัง, หนังสือ, เกม, เกม