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 7039569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:48:51+00:00 2026-05-28T01:48:51+00:00

both recursion as well as vector based iterative process can be used for DFS

  • 0

both recursion as well as vector based iterative process can be used for DFS tree(b-tree) traversal. In both the cases, we need extra space either in the stack while recursive calls or in a vector. Does any technique exists which doesn’t need space or needs min space?

  • 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-28T01:48:52+00:00Added an answer on May 28, 2026 at 1:48 am

    If you are searching a binary tree, you can represent each path taken as a pattern of bits. Accordingly, you can keep searching downwards from a root point, and keep track of your progress by twiddling the bits in a binary word. You’ll need one bit for each level.

    e.g.

           A
          / \
         B   C
        / \   \
       D   E   F
    

    If we start searching at A, the search specified by ABD is 00 (left – left); the next is 01, corresponding to left-right, or ABE; 10 is A-C-No child; and 11 is ACF.

    Notice that the least significant bit indicates the direction to turn at the end of the traversal (that is, it selects the leaf); if the bit sequence is read the other way, this method would specify a breadth-first traversal.

    You keep revisiting the same nodes, as a consequence of storing less information.

    Note that this amounts to a linear scan of your data, thus destroying the benefits of having a tree. If you are too space constrained to be able to afford a stack, I suggest that you use a pre-allocated vector. If you keep that sorted, you can do things like binary searches, which will be rather more efficient than this.

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

Sidebar

Related Questions

Both of these appservers are at least in part OSGI based. One (Glassfish) is
I'm facing a problem where both recursion and using a loop seem like natural
It seems to me that it would work perfectly well to do tail-recursion optimization
Assume you have a method Tree supersizeMe(Tree input) . Both input and the return
Is it possible to have a PHP function that is both recursive and anonymous?
Both the jQuery and Prototpye JavaScript libraries refuse to allow me to use a
Both are mathematical values, however the float does have more precision. Is that the
Both DataSource and DataSourceID are defined on 'grdCommunication'. Remove one definition. I just got
Both of them are mbeans. Both are intended to setup Hibernate Session Factory and
Both Session.Clear() and Session.Abandon() get rid of session variables. As I understand it, Abandon()

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.