Giter Club home page Giter Club logo

binary_trees's Introduction

The Binary Tree


binary-tree

Description:-

A binary tree is a type of tree data structure in which each node can have at most two child nodes, known as the left child and the right child. Each node of the tree consists of โ€“ data and pointers to the left and the right child.

Properties of a Binary Tree

The following are some of the important properties of a binary tree:

  • The maximum number of edges between the root and a leaf node determines the height of a binary tree.
  • A binary tree can have a maximum of 2d nodes at depth d.
  • A binary tree of height h can have a maximum of 2(h+1) โ€“ 1 nodes
  • In a binary tree, there can only be as many leaf nodes as internal nodes plus one

Advantages of binary tree:-

  • Effective searching and sorting: Binary trees are useful in a variety of applications because they offer effective searching and sorting operations.
  • Memory efficiency: Because binary trees use less memory than other tree structures like multi-way trees or linked lists, they are a viable option for huge data sets.
  • Fast insertion: As we know only a portion of the tree needs to be updated therefore binary trees enable fast element insertion.

Disadvantages of binary tree:-

  • Limited structure: Binary trees can only have two child nodes per node, which can restrict their versatility and usefulness in some applications.
  • Difficult to implement: It needs close attention to the node ordering and tree structure, implementing a binary tree can be difficult.
  • Inefficient for some operations: Some of the operations like finding the minimum or maximum value in a binary tree, can be less efficient and require additional steps and complexity to perform.

binary_trees's People

Contributors

elsaaeid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.