Algorithms and data structures for JS/TS
  • Introduction
  • GETTING STARTED
    • TS
    • Node.js
    • ES Modules
    • Browsers
  • PUBLIC API
    • How to read
    • Linked lists
      • SinglyLinkedList
      • DoublyLinkedList
      • CircularlyLinkedList
    • Stacks and queues
      • LinkedStack
      • LinkedQueue
      • LinkedDeque
      • CircularQueue
      • CircularArrayBuffer
      • UnsortedPriorityQueue
      • SortedPriorityQueue
      • AdaptableHeapPriorityQueue
    • Maps
      • SortedMap
      • MaximaSet
      • AVLTreeMap
      • SplayTreeMap
      • RedBlackTreeMap
    • Trees
      • GeneralTree
      • LinkedBinaryTree
      • PreorderTreeTraversal
      • InorderTreeTraversal
      • PostorderTreeTraversal
      • EulerTourTreeTraversal
    • Searches
      • Binary search
      • Quick select
    • Text processing
      • Longest common subsequence
      • Boyer-Moore
      • Knuth-Morris-Pratt
    • Position
    • Locator
    • Comparators
  • CONTRIBUTION NOTES
    • How to contribute
    • Project structure
  • Changelog
Powered by GitBook
On this page

Was this helpful?

  1. PUBLIC API

Trees

Hierarchical data structures with one root element having zero to many children each of those itself can be treated as a root of a subtree.

PreviousRedBlackTreeMapNextGeneralTree

Last updated 5 years ago

Was this helpful?

Import alias 'ads-js/trees'

Table of contents

- a tree in which each element can have either zero or many children. This structure is link-based.

- a tree in which each element can have either zero, one or two children. This structure is link-based.

- tree traversal algorithm that on each level of a tree visits root before traversing its subtrees.

- tree traversal algorithm that on each level of a tree visits root after traversing its leftmost subtree.

- tree traversal algorithm that on each level of a tree visits root after traversing its subtrees.

- tree traversal algorithm which walks around the tree in a 'bound-to-left' manner and visits each element 2 (pre and post) times for general and 3 (pre, in and post) times for binary trees.

GeneralTree
LinkedBinaryTree
PreorderTreeTraversal
InorderTreeTraversal
PostorderTreeTraversal
EulerTourTreeTraversal