{"id":23733794,"url":"https://github.com/marusyk/binarysearchtree","last_synced_at":"2026-01-02T15:05:17.472Z","repository":{"id":8771734,"uuid":"59704074","full_name":"Marusyk/BinarySearchTree","owner":"Marusyk","description":"Binary Tree as a cross platform NuGet package","archived":false,"fork":false,"pushed_at":"2024-12-30T22:49:13.000Z","size":130,"stargazers_count":32,"open_issues_count":0,"forks_count":20,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-12-30T23:25:40.013Z","etag":null,"topics":["algorithm","binary-trees","binarytree","c-sharp-library","csharp","dotnet","dotnet-standard","hacktoberfest","nuget","nuget-package","tree"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Marusyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-25T23:16:16.000Z","updated_at":"2024-12-30T22:49:16.000Z","dependencies_parsed_at":"2024-11-07T10:00:43.230Z","dependency_job_id":null,"html_url":"https://github.com/Marusyk/BinarySearchTree","commit_stats":{"total_commits":116,"total_committers":11,"mean_commits":"10.545454545454545","dds":0.5517241379310345,"last_synced_commit":"e56e7ac1cf139c6cf211491beb6fa78d00b6ee52"},"previous_names":["marusyk/binarysearchtree"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marusyk%2FBinarySearchTree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marusyk%2FBinarySearchTree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marusyk%2FBinarySearchTree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marusyk%2FBinarySearchTree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marusyk","download_url":"https://codeload.github.com/Marusyk/BinarySearchTree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231945870,"owners_count":18449946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","binary-trees","binarytree","c-sharp-library","csharp","dotnet","dotnet-standard","hacktoberfest","nuget","nuget-package","tree"],"created_at":"2024-12-31T05:19:36.578Z","updated_at":"2026-01-02T15:05:17.458Z","avatar_url":"https://github.com/Marusyk.png","language":"C#","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"BinaryTree.png\" alt=\"BinaryTree\" width=\"150\"/\u003e\n\u003c/p\u003e\n\n# Binary Search Tree [![Stand With Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua)\n\nC# Binary search tree\n\nThis project contains a cross platform Binary Tree implementation\n\n[![Build](https://github.com/Marusyk/BinaryTree/actions/workflows/builds.yml/badge.svg)](https://github.com/Marusyk/BinaryTree/actions/workflows/builds.yml)\n[![AppVeyor](https://ci.appveyor.com/api/projects/status/l3kmfu18f4fbmuvu?svg=true)](https://ci.appveyor.com/project/Marusyk/binarytree)\n[![GitHub release](https://badge.fury.io/gh/Marusyk%2FBinaryTree.svg)](https://github.com/Marusyk/BinaryTree/releases/tag/v5.2.0)\n[![NuGet package](https://badge.fury.io/nu/BinaryTree.svg)](https://www.nuget.org/packages/BinaryTree/)\n[![NuGet](https://img.shields.io/nuget/dt/BinaryTree.svg)](https://www.nuget.org/packages/BinaryTree/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Marusyk/BinaryTree/blob/main/LICENSE)\n[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/Marusyk/BinaryTree/blob/main/CONTRIBUTING.md)\n\n# Code Coverage\n\n[![Coverage Status](https://coveralls.io/repos/github/Marusyk/BinaryTree/badge.svg?branch=main)](https://coveralls.io/github/Marusyk/BinaryTree?branch=main)\n\n# How to Install\n\nYou can directly install this library from [Nuget](http://nuget.org). There is package:\n\n**[BinaryTree](https://www.nuget.org/packages/BinaryTree)**\n\n    PM\u003e Install-Package BinaryTree\n\n# How to use\n\nCreate a new instanse:\n`var binaryTree = new BinaryTree\u003cint\u003e();`\nand add elements:\n\n``` csharp\nbinaryTree.Add(8);\nbinaryTree.Add(5);\nbinaryTree.Add(12)\n```\n\nor use collection initializer like : `var binaryTree = new BinaryTree\u003cint\u003e() { 8, 5, 12, 3, 7, 10, 15 };`\n\nAnother way is constructs a BinaryTree, copying the contents of the given collection\n\n```csharp\nIList\u003cint\u003e numbers = new List\u003cint\u003e();\nvar binaryTree = new BinaryTree\u003cint\u003e(numbers);\n```\n\nAlso you can initialize a new instance of the BinaryTree class that is empty and has the specified initial capacity:\n`var binaryTree = new BinaryTree\u003cint\u003e(10);`\n\nBy default traversal is set to [**In-order**](https://en.wikipedia.org/wiki/Tree_traversal#In-order)\n\nYou can set the type of traversal in constructor `var binaryTree = new BinaryTree\u003cint\u003e(new PostOrderTraversal\u003cint\u003e());`\nor use property `TraversalStrategy`:\n\n```csharp\nvar inOrder = new InOrderTraversal\u003cint\u003e();\nvar preOrder = new PreOrderTraversal\u003cint\u003e();\nvar postOrder = new PostOrderTraversal\u003cint\u003e();\n\nbinaryTree.TraversalStrategy = preOrder;\n```\n\nAvailable operations:\n\n- `void Add(T value)` - adds a new element to the tree\n- `void AddRange(IEnumerable\u003cT\u003e collection)` - copying the contents of the given collection to the tree\n- `ITraversalStrategy\u003cT\u003e TraversalStrategy` -gets or sets type of traversal(Pre-order, In-order, Post-order)\n- `int Count` - returns count of elements in tree\n- `int Capacity` - gets the number of elements that the BinaryTree can contain\n- `bool IsReadOnly` - always return `false`\n- `bool IsFixedSize` - gets a value indicating whether the BinaryTree has a fixed size\n- `bool Contains(T value)` - checks if the tree contains the element\n- `bool Remove(T value)` - remove element from the tree. Returns `true` if element was removed.\n- `void Clear()` - clears tree\n- `void CopyTo(T[] array, int arrayIndex)` - copies all the elements of the tree to the specified one-dimensional array starting at the specified destination array index.\n- `IEnumerator\u003cT\u003e GetEnumerator()` - returns numerator of tree\n\nTo display all elements of tree, use:\n\n```csharp\nforeach (var item in binaryTree)\n{\n    Console.Write(item + \" \");\n}\n```\n\nor use extension method:\n\n```csharp\nbinaryTree.PrintToConsole();\n```\n\nor `binaryTree.PrintAsTree();`\n\n```\n      8\n     /  \\\n    5    12\n   / \\   / \\\n  3   7 10  15\n```\n\n## Operations complexity\n\u003ctable\u003e\n        \u003ctr\u003e\n            \u003ctd colspan=8\u003eTime Complexity\u003c/td\u003e\n            \u003ctd\u003eSpace Complexity\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd colspan=4\u003eAvarage\u003c/td\u003e\n            \u003ctd colspan=4 \u003eWorst\u003c/td\u003e\n            \u003ctd\u003e Worst\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003eAccess\u003c/td\u003e\n            \u003ctd\u003eSearch\u003c/td\u003e\n            \u003ctd\u003eInsertion\u003c/td\u003e\n            \u003ctd\u003eDeletion\u003c/td\u003e\n            \u003ctd\u003eAccess\u003c/td\u003e\n            \u003ctd\u003eSearch\u003c/td\u003e\n            \u003ctd\u003eInsertion\u003c/td\u003e\n            \u003ctd\u003eDeletion\u003c/td\u003e\n            \u003ctd\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\u003ccode\u003eO(log(n))\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(log(n))\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(log(n))\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(log(n))\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(n)\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(n)\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(n)\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(n)\u003c/code\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003ccode\u003eO(n)\u003c/code\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n\u003c/table\u003e\n\n## Build\n\nOn Windows:\n\n```powershel\nbuild.ps1\n```\n\nOn Linux/Mac:\n\n```bash\nbuild.sh\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://github.com/Marusyk/BinaryTree/blob/main/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/Marusyk/BinaryTree/blob/main/LICENSE) file for details\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarusyk%2Fbinarysearchtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarusyk%2Fbinarysearchtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarusyk%2Fbinarysearchtree/lists"}