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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:32:36+00:00 2026-05-13T07:32:36+00:00

I got that little function(I changed the name of variables) Private Function everythingLinked(ByRef myClass

  • 0

I got that little function(I changed the name of variables)

Private Function everythingLinked(ByRef myClass As cls, ByVal found As Boolean) As Boolean
    If Not found AndAlso myClass.checked = False Then
        myClass.checked = True
        For i = 0 To myClass.numLink 
            If Not found Then
                found = everythingLinked(masterArrayOfCls(myClass.linkNum(i)), myClass.isMiddlePoint)
            End If
        Next
    End If

    Return found
End Function

I want to rewrite it so it would only be loop and no recursion and I’m currently lost, anyone could give me some direction or anything?

edit What it does. (English is not my native language sorry)

I’m passing a class to this function(with a starting value for found as false) to know if it is linked to the middle of the tree.

The class got an array with a maximum of 4 link to other class and it can be circular(this is why I have a checked_link boolean).

It does the recursion until there is no more link(return false) to check or until it find the middle link(return true).

edit

for an example, this

in pos 0 got link with 1
in pos 0 got link with 6
in pos 1 got link with 0
in pos 1 got link with 7
in pos 2 got link with 3
in pos 2 got link with 8
in pos 3 got link with 4
in pos 3 got link with 2
in pos 4 got link with 3
in pos 5 got link with 11
in pos 6 got link with 0
in pos 7 got link with 8
in pos 7 got link with 1
in pos 8 got link with 9
in pos 8 got link with 2
in pos 8 got link with 7
in pos 8 got link with 14
in pos 9 got link with 8
in pos 10 got link with 11
in pos 10 got link with 16
in pos 11 got link with 5
in pos 11 got link with 10
in pos 11 got link with 17
in pos 12 got link with 13
in pos 13 got link with 12
in pos 13 got link with 19
in pos 14 got link with 15
in pos 14 got link with 8
in pos 14 got link with 20
in pos 15 got link with 14
in pos 16 got link with 10
in pos 16 got link with 22
in pos 17 got link with 11
in pos 18 got link with 19
in pos 18 got link with 24
in pos 19 got link with 20
in pos 19 got link with 13
in pos 19 got link with 18
in pos 19 got link with 25
in pos 20 got link with 21
in pos 20 got link with 14
in pos 20 got link with 19
in pos 20 got link with 26
in pos 21 got link with 20
in pos 22 got link with 23
in pos 22 got link with 16
in pos 22 got link with 28
in pos 23 got link with 22
in pos 23 got link with 29
in pos 24 got link with 18
in pos 25 got link with 19
in pos 26 got link with 27
in pos 26 got link with 20
in pos 27 got link with 28
in pos 27 got link with 26
in pos 28 got link with 22
in pos 28 got link with 27
in pos 29 got link with 23

middlepoint would be pos 15

the code above can prove that every position can be linked with the middlepoint

so initial arg would be

  everythingLinked(random pos, false)

and in this case it would be always true

  • 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-13T07:32:36+00:00Added an answer on May 13, 2026 at 7:32 am

    It seems to me that you have a graph and you are performing a depth-first search to find a path from a specific node to a node which is a middle point.

    If I’ve understood correctly, you do not need to have a checked_link property for each link, you just need a checked property for each node (what you call class) that you set when you start processing that node.

    To remove the recursion, you will need an auxiliary data structure. If you want to preserve the algorithm you currently use, this will need to be a stack (but you can use a queue to make it a breadth-first search). You start by pushing the initial class onto the stack and marking it checked. Then, you loop for as long as the stack is non-empty, popping the top class from it and pushing all non-checked linked classes, marking each of them checked. Terminate the loop if at some point the popped class is a middle point, otherwise the stack emptying will signal that a middle point was not found.

    (Sorry for not providing code, I am not sufficiently familiar with the language.)

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is nothing you can do. Your content management system… May 14, 2026 at 4:59 pm
  • Editorial Team
    Editorial Team added an answer If the intention is to incorporate your SIP stack into… May 14, 2026 at 4:59 pm
  • Editorial Team
    Editorial Team added an answer I believe you can just do something like this: myMultiView.SetActiveView(nameOfView);… May 14, 2026 at 4:59 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

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.