小编MRB*_*L93的帖子

找到二叉树高度

我正在尝试编写一个函数来获取二叉树的高度.当我打印值maxi的值是我所期望的但是当函数返回值时,值总是为0.有人可以告诉我这里做错了什么吗?

int treeHeight(tree *p)
{
    static int maxi=0;
    static int i=0;
    if(p==NULL)
    {
        return maxi;
    }
    else
    {
        if(p->left!=NULL||p->right!=NULL)
        {
            i++;
        }
        else
        {
            i++;
            if(maxi<i)
            {
                maxi=i;
            }
        }
        treeHeight(p->left);
        treeHeight(p->right);
        i--;
    }
}
Run Code Online (Sandbox Code Playgroud)

c++ tree binary-tree

3
推荐指数
1
解决办法
1万
查看次数

redshift 无法识别的节点类型 407

我正在开发一种同步机制,将数据从 aws redshift 移动到 aurora。为了降低网络 I/O 的负载,我正在转换 redshift 上的查询并向其添加校验和查询,这样我将仅导出已更改的记录。我用另一个 Select * 查询包装基本查询并添加校验和函数。

我尝试删除一些内部子查询,然后新查询开始工作,但我无法更改查询,因为它是由其他平台提供的。

基本查询:

select x.player_id as playerid,
                                    p.player_nickname, 
                                    r.region_code,
                                    s.title as season_name,

                                    x.rating as ranking_score,
                                    x.rank_no as rank_no,
                                    x.rank_no_change as rank_no_change,

                                    x.game_mode, 

                                    to_char(ga.total_score, 'FM9D00') as gyo_perf_total_score,
                                    to_char(agressive_score*100/aggresive_weight, 'FM9D000') as gyo_perf_aggressive_score, 
                                    to_char(defensive_score*100/defensive_weight, 'FM9D000') as gyo_perf_defensive_score, 
                                    to_char(survival_score*100/survival_weight, 'FM9D000') as gyo_perf_survival_score,

                                    ga.match_place_avg,

                                    rounds_played, 

                                    kills, 
                                    (kills*1.0)/rounds_played as avg_kills_per_round,
                                    assists, 
                                    (assists*1.0)/rounds_played as avg_assists_per_round,
                                    headshot_kills, 
                                    top10s, 
                                    (top10s*1.0)/rounds_played as top10s_ratio,
                                    wins, 
                                    (wins*1.0)/rounds_played as win_ratio,
                                    case when top10s = 0 then 0 else (wins*1.0)/(top10s*1.0) end as win_to_top10_ratio, …
Run Code Online (Sandbox Code Playgroud)

sql amazon-redshift

3
推荐指数
1
解决办法
5094
查看次数

标签 统计

amazon-redshift ×1

binary-tree ×1

c++ ×1

sql ×1

tree ×1