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

  • SEARCH
  • Home
  • 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 259993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:18:38+00:00 2026-05-11T22:18:38+00:00

I have a binary tree where each node can have a value. I want

  • 0

I have a binary tree where each node can have a value.

I want to find the node in the tree that has value null and is closest to the root. If there are two nodes with the same distance from the root, either will do. I need to minimize the number of read accesses to the binary tree. Assume that working memory is limited to just k nodes.

DFS to depth k is exhaustive but will not find the closest node unless I run through the whole tree first. BFS will find the closest, but it might fail because DFS can find deeper nulls with the same memory.

I’d like to have the fewest number of read accesses to the tree and find the closest null node.

(I’ll need to implement this in n-way trees eventually, too, so a general solution would be good. No write access to the tree, just read.)

  • 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-11T22:18:38+00:00Added an answer on May 11, 2026 at 10:18 pm

    You may want to look at Iterative-deepening depth-first search. It will find the closest node automatically but will be able to reach the same depth as DFS. It will use more read accesses though.

    You could also start with BFS, and if you don’t find a null with the allowed memory, run DFS.

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

Sidebar

Ask A Question

Stats

  • Questions 504k
  • Answers 504k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Consider using IContextMenu. IContextMenu is how Windows Explorer accesses the… May 16, 2026 at 3:08 pm
  • Editorial Team
    Editorial Team added an answer remainder of 3/7 is 3..since it went 0 times with… May 16, 2026 at 3:08 pm
  • Editorial Team
    Editorial Team added an answer It's done by passing a collection data-source: new BeanCollectionDataSource(yourArrayList); And… May 16, 2026 at 3:08 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a binary tree of some shape . I want to Convert it
I have multiple binary trees stored as an array. In each slot is either
I have binary array in c, I want to compress the array, kindly suggest
A binary tree of N nodes is 'curious' if it is a binary tree
I need to find an algorithm for generating every possible permutation of a binary
I was just looking at Eric Lippert's simple implementation of an immutable binary tree
Is there another way to do this? Just spent 2 hours trying to figure
If I have a large set of continuous ranges ( e.g. [0..5], [10..20], [7..13],[-1..37]
Dear all: In advance, thank you for your time. Lately, I have decided to
If I have a set of tags (<100), and a set of objects (~25000),

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.