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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:20:15+00:00 2026-06-11T18:20:15+00:00

I have the text content full of expressions like: a = 1 d =

  • 0

I have the text content full of expressions like:

a = 1
d = b + c 
b = a * c
c = 2 - a
...

This expressions may be written in random order. I can extract each of these expressions and evaluate each of them but I need to find optimal algorithm to avoid circular evaluations like:

a = 1
d = ? (skip)
b = ? (skip)
c = 2 - a = 1
...
d = ? (skip)
b = a * c = 1
...
d = b + c = 2
...

Is there the way “to order” the equations by the involved arguments to avoid extra calculation passes by like:

a = 1
c = 2 - a = 1
b = a * c = 1
d = b + c = 2
...

?

  • 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-06-11T18:20:16+00:00Added an answer on June 11, 2026 at 6:20 pm

    For each expression, create a node in a graph, where the incoming edges are the other expressions it depends upon. Then use a topological sort to determine the evaluation order.

    Example:

    Expressions:

    a = 1
    d = b + c 
    b = a * c
    c = 2 - a
    

    Graph nodes:

    a()
    d(b,c)
    b(a,c)
    c(a)
    

    Topological sort:

    begin
        process a
            process a's dependencies (none)
            output a
            mark a as done
        process d
            process d's dependencies
                process b
                    process b's dependencies
                        process a (already done)
                        process c
                            process c's dependencies
                                process a (already done)
                            output c
                            mark c as done
                    output b
                    mark b as done
                process c (already done)
            output d
            mark d as done
        process b (already done)
        process c (already done)
    end
    

    Result:

    a c b d
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can we have content text directly in <div>text content</div> or it should be like
I want to be able to have default text like Enter content here... appear
I have a directory full of email files, which look like this: From: Scoop
Say I have the following text ..(content)............. <A HREF=http://foo.com/content >blah blah blah </A> ...(continue
I have the following text: --------------030805090908050805080502 Content-Type: image/jpeg Content-Transfer-Encoding: base64 Content-ID: <part16.07030906.00090703@highcontrast.ro> /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAA /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAARgAA/+4ADkFkb2JlAGTAAAAA
I have a text box whose content is constantly changing and whenever that happens,
I have custom components which must adjust their text content based on space constraints.
I have textarea containing one or more URLs, along with other text content. I
I have a script which collects an image, link and some text content from
I have a description text file with content constructed in such manner: Book title

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.