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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:19:59+00:00 2026-06-04T15:19:59+00:00

Okay so I’m reading some code about RedBlackTrees. And I noticed this line v1

  • 0

Okay so I’m reading some code about RedBlackTrees. And I noticed this line “v1 = v2 = v3 = v4;” and I understand something like “v1 += v2” (add v2 to the current value of v1) and “v1 = v2” (create a reference from v2 to v1) etc.

public void insert( AnyType item )
{
    current = parent = grand = header;

But I’m curious to what is happening in the memory/references with current = parent = grand = header;

http://faculty.washington.edu/moishe/javademos/REDBlack/RedBTree.java

Edit : 10:46 PM

I still have to wait 10 minutes to approve questions, sorry for the wait ladies and gents.

  • 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-04T15:20:01+00:00Added an answer on June 4, 2026 at 3:20 pm

    What’s happening is that the value of header is assigned to the value of grand which is assigned to the value of parent which in turns gets assigned to current. In the end, the 4 variables hold the same value; this idiom is used to quickly initialize several variables to the same value and it’s equivalent to this:

    grand = header;
    parent = grand;
    current = parent;
    

    The assignment occurs from right-to-left, in fact the expression in the question is evaluated like this:

    current = (parent = (grand = header));
    

    This works because the result of the assignment operator actually evaluates to the assigned value, for example this works:

    return x = 42;
    

    In the last snippet, 42 gets assigned to x and then the value of x gets returned.

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

Sidebar

Related Questions

Okay, I'm reading about Linux kernel development and there are some code snippets using
Okay, so I've known about this for like 600 years now, but I've only
Okay so say I have a form element like this: HTML: <div class=form-item> <label>Current
Okay so my question is this. Say I have a simple C++ code: #include
Okay So this doesnt make sense to me.... maybe someone can shed some light.
Okay so I need help understanding something. I understand how ? : are used
Okay, first some background, I can't use any javascript library except YUI for this
Okay so im working on this php image upload system but for some reason
Okay. I know this looks like the typical Why didn't he just Google it
Okay so I have two import pieces of code involved in this. This first

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.