封开县 吉林省 秭归县 酉阳 怀宁县 阿坝县 大理市 兰坪 廉江市 阿城市 六枝特区 修武县 临夏县 乐都县 连城县 子长县

文章导航软件下载单机游戏安卓资源苹果资源

pc软件新闻操作系统工具服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯越狱ios软件教程mac教程

单机游戏角色扮演动作射击体育竞技模拟经营其它游戏游戏工具

网游cf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:角色扮演 → 怪物猎人世界新装备介绍 怪物猎人世界新装备新系统一览

斗龙战士_二叉树结构 统计每一个叶子节点下的节点的数量

标签:事半功百 同乐门娱乐注册送18

类如下:

<?php
class getUserLeftRightNumber
{
    public $arr_all;
    public $arr_init;
    public $arr_leaf;
    public $arr_res;
    public function __counstruct()
    {
    
    }

    public function getUserNum()
    {
        // ini_set("memory_limit","6144M");
        // set_time_limit(0);

        // header("content-type:text/html;charset=utf-8"); 
        // define("DB_HOST","127.0.0.1"); 
        // define("DB_USER","root"); 
        // define("DB_PASS","root"); 
        // define("DB_NAME","test"); 
        // define("DB_PORT",3306); 
        // define("DB_CHAR","utf8"); 
        // define("APPNAME",""); 
        // $mysqli = new mysqli( DB_HOST, DB_USER, DB_PASS, DB_NAME);
        // $rst = $mysqli->query( "set names " . DB_CHAR );
        // $sql = "select * from ub_user_expand";王牌御史_2018年最新新闻网
        // $result=$mysqli->query($sql);
        // $array=array(); 
        // while( $rows=$result->fetch_assoc() )
        // {
        //     $r["uid"] = $rows["uid"];
        //     $r["name"] = $rows["username"];
        //     $r["_referee"] = $rows["_referee"];
        //     $r["_left"] = $rows["_left"];
        //     $r["_right"] = $rows["_right"];
        //     $r["position"] = $rows["position"];

        //     $this->arr_all[] = $r;
        // }
        // print_r($this->arr_all);die();

        $this->arr_all[0]  = array("uid" => "10000000", "_referee" => "","name" => "101001", "_left" => "10000001", "_right" => "10000002", "position" => "" );
        $this->arr_all[1]  = array("uid" => "10000001", "_referee" => "101001", "name" => "102001", "_left" => "10000003", "_right" => "10000004", "position" => 1 );
        $this->arr_all[2]  = array("uid" => "10000002", "_referee" => "101001", "name" => "102002", "_left" => "10000005", "_right" => "10000006", "position" => 2 );
        $this->arr_all[3]  = array("uid" => "10000003", "_referee" => "102001", "name" => "103001", "_left" => "10000007", "_right" => "10000008", "position" => 1 );
        $this->arr_all[4]  = array("uid" => "10000004", "_referee" => "102001", "name" => "103002", "_left" => "10000009", "_right" => "10000010", "position" => 2 );
        $this->arr_all[5]  = array("uid" => "10000005", "_referee" => "10胜者为王_2018年最新新闻网      $this->arr_all[15] = array("uid" => "10000015", "_referee" => "104001", "name" => "105001", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[16] = array("uid" => "10000016", "_referee" => "104001", "name" => "105002", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[17] = array("uid" => "10000017", "_referee" => "104002", "name" => "105003", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[18] = array("uid" => "10000018", "_referee" => "104002", "name" => "105004", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[19] = array("uid" => "10000019", "_referee" => "104003", "name" => "105005", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[20] = array("uid" => "10000020", "_referee" => "104003", "name" => "105006", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[21] = array("uid" => "10000021", "_referee" => "104004", "name" => "105007", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[22] = array("uid" => "10000022", "_referee" => "104004", "name" => "105008", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[23] = array("uid" => "10000023", "_referee" => "104005", "name" => "105009", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[24] = array("uid" => "10000024", "_referee" => "104005", "name" => "105010", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[25] = array("uid" => "10000025", "_referee" => "104006", "name" => "105011", "_left" => "",  "_right" =&范冰冰新剧路透照_2018年最新新闻网gt; "", "position" => 1 );
        $this->arr_all[26] = array("uid" => "10000026", "_referee" => "104006", "name" => "105012", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[27] = array("uid" => "10000027", "_referee" => "104007", "name" => "105013", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[28] = array("uid" => "10000028", "_referee" => "104007", "name" => "105014", "_left" => "",  "_right" => "", "position" => 2 );
        $this->arr_all[29] = array("uid" => "10000029", "_referee" => "104008", "name" => "105015", "_left" => "",  "_right" => "", "position" => 1 );
        $this->arr_all[30] = array("uid" => "10000030", "_referee" => "104008", "name" => "105016", "_left" => "",  "_right" => "", "position" => 2 );


        // 循环处理数据 获取 叶子节点
        foreach ( $this->arr_all as $key => $value ) 
        {
            $this->arr_init[$value["name"]] = $value;
            if ( empty( $value["_left"] ) && empty( $value["_right"] ) ) 
            {
                $this->arr_leaf[] = $value;
            }
        }

        foreach ( $this->arr_leaf as $key => $value ) 
        {
            $this->g法甲_2018年最新新闻网etUserNumInit( $this->arr_init, $value, 0 );
        }

        print_r( $this->arr_res );
    
    }

    public function getUserNumInit( $all, $leaf, $count_last )
    {
        if ( !empty( $leaf ) && is_array( $leaf ) && !empty($leaf["_referee"]) ) 
        {
            // echo "<br/>".$leaf["name"]."<br/>";
            $count      = 0;
            $count_self = 1;
            $count_all  = $count_self + $count_last;

            $res_key    = $lea

使用

$obj = new getUserLeftRightNumber();
$obj->getUserNum();

当前文章:http://www-cijilie-com.kunenergy.cn/dwjui/8659d_151357.html

发布时间:2019-07-24 14:34:47

巴菲特被8岁女孩问倒 称是华人女登山家罗静粉  澳门银河yh7788.bet  919银河优越会  澳门银河手机网站俄罗斯红场5月4日至9日将关闭参观  澳门银河娱乐官网下载  澳门银河真人在线娱乐  银河娱乐手机版yh163am.com  银河娱乐首页yh163am.com  银河国际手机网址2949  澳门银河娱乐yh163am.com  

相关阅读 新华社调查奇葩证明:老人为证明自己活着举当天报纸拍照不认委内瑞拉选举结果 美洲14国要召回大使小米8透明探索版真机抢先看!骁龙845处理器清晰可见富豪远行家中机关重重的密室遭打洞 2000万藏品被盗?? ??? ????

文章评论
发表评论

热门文章 古巴坠机事故致100余人遇难 3名幸存者被送医治疗粉丝自制哆啦A梦动画《大雄的喜马拉雅行进记》 小伙伴们一起逛遍中国联想正在打造新一代Yoga Book:已获蓝牙技术联盟认证一波三折后重回正轨:美朝首脑会晤将如期举行

最新文章 联想正在打造新一代Yoga Book:已获蓝牙技术联盟认证天猫618开门红:服饰13分钟成交额超去年全天,小米8一分钟抢光 美媒:避免破坏美朝会晤气氛 美B-52轰炸机避飞朝鲜半岛北京市政府副秘书长王晓明患有抑郁症坠楼身亡Spring IOC 容器源码分析 - 获取单例 bean

人气排行 美媒:美国商务部就解除对中兴销售禁令通报国会党报关注东北人才流失:与南方发达城市待遇差距大苹果从英特尔挖来多名工程师:Mac或许真要转向自主芯片了未来三年 陕西旅游品质将大力提升穿越蜘蛛星云:新图像揭示16万光年外的宇宙景观