Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6930613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:28:11+00:00 2026-05-27T11:28:11+00:00

Right, I am studying CS and have been completing a lab in C, it

  • 0

Right, I am studying CS and have been completing a lab in C, it has all gone pretty well but I’ve now hit something that appears to be impossible to solve for the bonus marks. I’ve been on this for a day or two and simply cannot figure out a correct way of completing this.

Introduction

A summary of the tasks so far:

Build the game of pangolins, where the computer stores the questions and objects in a tree structure. The game works as follows: You think of an object and the computer tries to guess what you are thinking of by asking you a series of ‘yes/no’ questions. If the computer guesses correctly, it wins. If you manage to fool it, you win, but you must then provide the computer with a question that would allow it to guess correctly next time round. That’s all there is to it.

An example of the tree structure you end up with (from left->right):

                Tree
                /
        Is it made of wood?
                \
                Grass
        /
Is it green?
        \
                Pangolin
                /
        Does it have a legs?
                \
                                Computer
                                /
                        Is it larger than a microwave?
                                \
                                Laptop
                        /
                Does it have a keyboard?
                        \
                        Desk

Where this is made of the following struct:

typedef struct node {
  char* object_name; // object-name (which may be NULL)
  char* question; // question (which may be NULL) 

  struct node *yesNode; // where if yes (NULL)
  struct node *noNode; // where if no (NULL)
} node;

Where the above tree is stored as the following file:

Is it green?
Does it have a legs?
Does it have a keyboard?
        Desk
Is it larger than a microwave?
        Laptop
        Computer
        Pangolin
Is it made of wood?
        Grass
        Tree

The Problem

The bonus is as follows:

Make your program take an arbitrary number of input files, and graft
them together to make a huge tree. Swap your files with your friends
and get a huge collection of pointless questions. To do this properly
you need to scan for duplicate entries (you won’t be able to do this
perfectly, but it should at least weed out obvious duplicates and
graft the trees together in sensible ways.)

Or summarised:

Take your two tree structs (or files representing tree structs) and merge them together to produce a larger tree, while removing duplicates.

My problem:

  1. How is it possible to remove two unsorted trees?
  2. Is it even possible to remove duplicates without manually checking every node?
  3. How do you even loop to the bottom of every node and compare that to the other tree?

My best idea:

  1. Search the second tree for objects that are in the first tree also
  2. Replace those objects with pangolin object
  3. Find all occurrences of pangolin in the first
  4. Point the parent to the top of the second tree instead

But this breaks the tree structure, and potentially makes the game break (say the top question in the first tree was is it red) and the second tree was attached on the no node and all the items in the second tree were red?

My main questions:

  • Do you have any idea as to how you would solve this? Or a hack that would kind of work?
  • How do you even find duplicates in two trees?
  • How do you attach the trees together?
  • How do you loop through the bottom of each tree?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:28:12+00:00Added an answer on May 27, 2026 at 11:28 am

    I think the easiest way to join all your trees is by re-building a minimum entropy decision tree, like this:

    1. Consider all the items.
    2. Create a new node.
    3. For the node, choose the question that distinguishes between the most items in the current set of items:
      • note that the number of items that a question distinguishes between is the sum of all of the items beneath the question in every tree where the question occurs.
    4. Split the set of items according to the question.
    5. Repeat recursively from step 2 for each of the two new sets.

    When it comes to associating logically identical but linguistically different questions… that’s an extremely difficult natural language problem. Without doing any language analysis you could do something simple like compare the question strings ignoring case, punctuation and spacing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am studying Java concurrency right now. I have a question about synchronized and
Right now, I keep all of my projects on my laptop. I'm thinking that
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I
Right now I have an SSIS package that runs every morning and gives me
I'm studying Wikipedia REST API but I'm not able to find the right option
I've been studying .Net threading and have learned about the Threading.Task and Threading.Task.Parallel classes.
My app is using htmlagility pack. As of right now I can get all
I'd like to write a screenshot tool in Python. Right now i'm studying how
I'm studying C# right now and currently learning threading. Here is a simple example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.