Chapter 3:   Exercises 6, 16, & 17


Ex 6:
You are writing a program to track the results of the NCAA playoffs.   This is a distributed application, running at the site of each game.   The various hosts regularily exchange information to keep each other up to date on the status of the teams.   Decide what information you will need to exchange and write the ASN.1 definitions of the information.

Information needed for exchange to keep track of NCAA playoffs (assuming Basketball playoffs):
Division, HomeTeam/VisitingTeam Name and FinalScore.

ASN.1 definitions of this information:
NCAAGame ::= SEQUENCE
{
    NCAADivision  IA5String
    {
        HomeTeam  SEQUENCE
        {
            Name  IA5String,
            FinalScore  INTEGER
        },
        VisitingTeam  SEQUENCE
        {
            Name  IA5String,
            FinalScore  INTEGER
        },
    },
}


Ex 16:
Write an ASN.1 recursive definition of a binary tree.

BinaryTree ::= SEQUENCE
{
    value  CHOICE
    {
        nodevalue  INTEGER OPTIONAL,
        node  SEQUENCE OF BinaryTree OPTIONAL
    }
}


Ex 17:
Use your definition of a binary tree in the preceding exercise to represent the following instance:

                      50
                   /       \
                  /         \
              42           60
            /      \         /
        30      47     58
            \
             25


value node
{
    {value nodevalue 50,
    value node
    {
        {value nodevalue 42,
        value node
        {
            {value nodevalue 30,
            value node
            {
                 {value nodevalue 25}
            }}
        }
        value node
        {
            {value nodevalue 47,
        }}
    }
    value node
    {
        {value nodevalue 60,
        value node
        {
             {value nodevalue 58}
        }}
    }}
}