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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:23:45+00:00 2026-05-31T06:23:45+00:00

I have an object structure that is mimicking the properties of an excel table.

  • 0

I have an object structure that is mimicking the properties of an excel table. So i have a table object containing properties such as title, header row object and body row objects. Within the header row and each body row object, i have a cell object containing info on each cell per row. I am looking for a more efficient way to store this table structure since in one of my uses for this object, i am printing its structure to screen. Currently, i am doing an O(n^2) complexity for printing each row for each cell:

foreach(var row in Table.Rows){
   foreach(var cell in row.Cells){
      Console.WriteLine(cell.ToString())
   }
}

Is there a more efficient way of storing this structure to avoid the n^2? I ask this because this printing functionality exists in another n^2 loop. Basically i have a list of tables titles and a list of tables. I need to find those tables whose titles are in the title list. Then for each of those tables, i need to print their rows and the cells in each row. Can any part of this operation be optimized by using a different data structure for storage perhaps? Im not sure how exactly they work but i have heard of hashing and dictionary?

Thanks

  • 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-31T06:23:46+00:00Added an answer on May 31, 2026 at 6:23 am

    Since you are looking for tables with specific titles, you could use a dictionary to store the tables by title

    Dictionary<string,Table> tablesByTitle = new Dictionary<string,Table>();
    
    tablesByTitle.Add(table.Title, table);
    ...
    
    table = tablesByTitle["SomeTableTitle"];
    

    This would make finding a table an O(1) operation. Finding n tables would be an O(n) operation.

    Printing the tables then of cause depends on the number of rows and columns. There is nothing, which can change that.


    UPDATE:

    string tablesFromGuiElement = "Employees;Companies;Addresses";
    string[] selectedTables = tablesFromGuiElement.Split(';');
    foreach (string title in selectedTables) {
        Table tbl = tablesByTitle[title];
        PrintTable(tbl);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tree-like object structure that consists of two types of objects: object
I have an entity that is actually tree object structure (defining only relevant properties
I have a database structure that has a Person table which contains fields such
I have a server application with such structure: There is one object, call him
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,
I have an object structure that looks like this: var Results = new List<ResultObj>()
I have a highly nested OBJECT TYPE structure that allows me to hold data
I have a master product list that has a logical object structure: var myProducts
I have a structure that looks like this: <div class=project_group> <table> <tr style=display:none> <td>...</td>
I have a structure in C#.net. I have created an object of that structure.

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.