网络营销二叉树

发布于 2024-10-09 23:52:28 字数 147 浏览 0 评论 0原文

我正在创建一些网络营销代码,并且正在考虑使用 PHP 面向对象编程。我想知道如何继续处理代码。

它是对象的二叉树。因此只有左孩子和右孩子。我可以为此研究他们的源代码吗?

我已经创建了一个,但是是用 C# 编写的,而且我对 PHP OOP 不太熟悉。

I'm creating some network marketing code and I'm thinking of using PHP object oriented proramming. I was wondering how I could proceed with the code.

It's a Binary Tree of objects. Thus having only left and right children. Is their any source code I could study for this?

I have created one already but is in C#, and I'm not too familiar with PHP OOP.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离鸿 2024-10-16 23:52:28

您需要这样的代码吗?如果您已经有 C# 版本,我认为使用此示例可以轻松更改为 PHP。

class Node
{
    private $left;
    private $right;
    private $data;

    public function __construct()
    {
        //...
    }

    public function search($key)
    {
        //...
    }

    //...
}

class BinaryTree
{
    private $root;

    public function __construct()
    {
        $this->root = new Node();
        //...
    }

    //...
}

Do you need some code like this? If you already had a C# version, I think it is easy to change to PHP with this sample.

class Node
{
    private $left;
    private $right;
    private $data;

    public function __construct()
    {
        //...
    }

    public function search($key)
    {
        //...
    }

    //...
}

class BinaryTree
{
    private $root;

    public function __construct()
    {
        $this->root = new Node();
        //...
    }

    //...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文