6-20 No Less Than X in BST(20 point(s))

6-20 No Less Than X in BST(20 point(s))

You are supposed to output, in decreasing order, all the elements no less thanX in a binary search tree T.

Format of function:

void Print_NLT( Tree T,  int X );

where Tree is defined as the following:

typedef struct TreeNode *Tree;
struct TreeNode {
    int Element;
    Tree  Left;
    Tree  Right;
};

The function is supposed to use Output(X) to print X.

Sample program of judge:

#include <stdio.h>
#include <stdlib.h>

typedef struct TreeNode *Tree;
struct TreeNode {
    int Element;
    Tree  Left;
    Tree  Right;
};

Tree BuildTree(); /* details omitted */
void Output( int X ); /* details omitted */

void Print_NLT( Tree T,  int X );

int main()
{
    Tree T;
    int X;

    T = BuildTree();
    scanf("%d", &X);
    Print_NLT( T, X );
    printf("End\n");

    return 0;
}

/* Your function will be put here */

Sample Output 1 (for the tree shown in Figure 1):

92 91 90 85 81 80 End

Figure 1

Sample Output 2 (for the tree shown in Figure 2):

End

Figure 2
code:
void Print_NLT( Tree T,  int X ){
    if(T == NULL)return;//如果树为空,返回null
    //直接进行树的遍历,因为是从大到小输出不小于X的数
    //所以先遍历右子树,大于X的直接输出,再遍历左子树.
    Print_NLT(T->Right,X);
    if(T->Element>=X){
        printf("%d ",T->Element);
    }
    Print_NLT(T->Left,X);
    
}


11.2.1 Power Up (and after a software generated register reset) Procedure Guidance Turn on external power supplies and wait for supply voltages to settle. This amount of time will be dependent on the system design. Software may choose to test the NAU88C22 to determine when it is no longer in an active reset condition. This procedure is described in more detail in the sections relating to power supplies. If the VDDSPK supply voltage is 3.60V or less, the next step should be to configure all of the output registers for low voltage operation. This sets the internal DC levels and gains to optimal levels for operation at lower voltages. Register settings required for this are: R49 Bit 2, SPKBST; Bit 3, AUX2BST; Bit 4, AUX1BST, set to logic = 0 As a general policy, it is a good idea to put any input or output driver paths into the “mute” condition any time internal register and data path configurations are being changed. Be sure at this time that all used inputs and outputs are in their muted/disconnected condition. Next, the internal DC tie-off voltage buffers should be enabled: R1 Bit 2, IOBUFEN, set to logic = 1 R1 Bit 8, DCBUFEN, set to logic = 1 if setting up for greater than 3.60V operation Value to be written to R1 = 0x104 At this point, the NAU88C22 has been prepared to start charging any input/output capacitors to their normal operating mode charge state. If this is done slowly, then there will be no pops and clicks. One way to accomplish this is to allow the internal/external reference voltage to charge slowly by means of its internal coupling resistors. This is accomplished by: R1 Bits 1, Bit 0, REFIMP set to 80kΩ setting R1 Bit 2, ABIASEN, set to logic = 1 Value to be written to R1 = 0x10D After this, the system should wait approximately 250ms, or longer, depending on the external components that have been selected for a given specific application. After this, outputs may be enabled, but with the drivers still in the mute condition. Unless power management requires outputs to be turned off when not used, it is best for pops and clicks to leave outputs enabled at all times, and to use the output mute controls to silence the outputs as needed. Next, the NAU88C22 can be programmed as needed for a specific application. The final step in most applications will be to unmute any outputs, and then begin normal operation. 以上上电控制的逻辑请解释
最新发布
05-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值