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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:57:46+00:00 2026-05-22T19:57:46+00:00

Currently I’m representing a binary tree in the following manner: [None,2,[None,3,None]] The tree above

  • 0

Currently I’m representing a binary tree in the following manner:

[None,2,[None,3,None]]

The tree above is rooted at 2. None means that the branch is empty.

I’d rather implement this in a list.
Are there better ways to do this (without resorting to creating classes) ?

  • 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-22T19:57:47+00:00Added an answer on May 22, 2026 at 7:57 pm

    It is possible to represent a binary tree using a flat list, as described here. How wasteful this method is would depend on the shape of your tree.

    I am curious as to why you insist on avoiding classes. If you were to wrap this in a class, you could define a clean API and hide the details of your implementation from the eventual user.

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

Sidebar

Related Questions

Currently, I am developing a product that does fairly intensive calculations using MS SQL
Currently I using the following code to get my JSON output from MySQL. <?php
Currently am developing a program that solves (if possible) any given labyrinth of dimensions
Currently I have some legacy ASP.NET 2.0 code that uses the ASP Xml web
Currently have the following expression: @[TMS_Dest] + \\ + @[TMS_Rename] + (DT_WSTR,4)DatePart(yyyy, GetDate()) +
Currently I have alot of information that are in several different divs. I want
Currently, my ListViews look like this: How can I achieve that Windows 7 native
Currently, my Perl output is hard-coded to dump into the following Unix directory: my
Currently, I'm using && and || instead of AND and OR because that's how
Currently I have an ActionFilter that gets the current users name from HttpContext and

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.