文章

2

粉丝

0

获赞

5

访问

502

头像
判断二叉树是否对称 题解:
P1551 东北大学机试题
发布于2025年3月16日 21:58
阅读数 312

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//统计#的数量
int calc(char temp[], int index){
    int count = 0;
    for(int i = 0; i < index; i++){
        if(temp[i] == '#'){
            count++;
        }
    }
    return count;
}
//判断某一层是否对称
int marror(char temp[], int index){
    int low, high;
    low = 0;
    high = index -1;
    while(low<high){
        if(temp[low]=='#'&&temp[high]!='#'){
            return 0;
        }
        if(temp[low]!='#'&&temp[high]=='#'){
         &nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发