Skip to content

RoshanShrestha123/binary-tree-traversal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Binary Tree Traversal

This Go program demonstrates a basic binary tree traversal using Depth-First Search (DFS). diagram

Overview

The program defines a Node struct that represents nodes in a binary tree. The traverse method is used to perform DFS traversal, printing the value of each node.

How It Works

Binary tree traversal involves visiting each node in a specific order without revisiting nodes. In this program:

  • Node Struct: Defines a node with an integer value and pointers to left and right child nodes.
  • traverse Method: Implements DFS traversal recursively. It prints the value of the current node, then traverses its left and right children.

Usage

  1. Clone Repository: Clone this repository to your local machine.
  2. Build: Compile and build the Go program using go build.
  3. Run: Execute the built binary to see the binary tree traversal in action.

Contributions

Contributions are welcome! Feel free to fork this repository and submit pull requests to enhance the functionality or add features.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This Go program demonstrates a basic binary tree traversal using Depth-First Search (DFS).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages