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

โครงสร้างข้อมูล Tree ใน JavaScript


Tree แสดงโครงสร้างลำดับชั้น เช่น organization hierarchy charts, file systems ฯลฯ เพื่อให้เป็นทางการมากขึ้น Tree สามารถกำหนดได้แบบ recursive (locally) ว่าเป็น collection of nodes (เริ่มที่ root node) โดยแต่ละ node เป็น data structure ประกอบด้วย value พร้อม list of references ไปยัง nodes (children) โดยมีข้อจำกัดว่าไม่มี reference ซ้ำ (แต่ละ child มี parent เพียง 1 ตัว)