Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Is it possible to access a row in a datatable in constant time?

Is it possible to access a row in a datatable in constant time?

Scheduled Pinned Locked Moved Database
questionhostingcloudalgorithms
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ryan Andrus
    wrote on last edited by
    #1

    Is there a way to configure\create a datatable (strongly typed or untyped) that can have a row accessed in constant time if you are searching on the primary key? If there isn't a way, then what is the quickest way to access a row when using datatables? Thanks, Ryan

    "I'm a mushroom cloud layin motherf*cker, motherf*cker!" - Marsellus Wallace from Pulp Fiction

    C 1 Reply Last reply
    0
    • R Ryan Andrus

      Is there a way to configure\create a datatable (strongly typed or untyped) that can have a row accessed in constant time if you are searching on the primary key? If there isn't a way, then what is the quickest way to access a row when using datatables? Thanks, Ryan

      "I'm a mushroom cloud layin motherf*cker, motherf*cker!" - Marsellus Wallace from Pulp Fiction

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Ryan Andrus wrote:

      have a row accessed in constant time

      What is "constant time"? Additional: To the person that voted this a 1. Why is this not a valid question? When I read the OP's request I wondered if he meant "real time" or something else. So I asked for clarification. What is so wrong with that?! -- modified at 19:49 Tuesday 26th June, 2007


      Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Ready to Give up - Your help will be much appreciated. My website

      R 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Ryan Andrus wrote:

        have a row accessed in constant time

        What is "constant time"? Additional: To the person that voted this a 1. Why is this not a valid question? When I read the OP's request I wondered if he meant "real time" or something else. So I asked for clarification. What is so wrong with that?! -- modified at 19:49 Tuesday 26th June, 2007


        Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Ready to Give up - Your help will be much appreciated. My website

        R Offline
        R Offline
        Ryan Andrus
        wrote on last edited by
        #3

        O(1) in Big O notation which basically means that the amount of time to find one row in the datatable is independent of the number of rows. In other words, it will always take the same amount of time to access a row in the datatable. The same way that getting an element in an array in C++ is constant time because it is done through pointer arithmetic and not by iterating through the elements.

        "I'm a mushroom cloud layin motherf*cker, motherf*cker!" - Marsellus Wallace from Pulp Fiction

        A 1 Reply Last reply
        0
        • R Ryan Andrus

          O(1) in Big O notation which basically means that the amount of time to find one row in the datatable is independent of the number of rows. In other words, it will always take the same amount of time to access a row in the datatable. The same way that getting an element in an array in C++ is constant time because it is done through pointer arithmetic and not by iterating through the elements.

          "I'm a mushroom cloud layin motherf*cker, motherf*cker!" - Marsellus Wallace from Pulp Fiction

          A Offline
          A Offline
          Arun Immanuel
          wrote on last edited by
          #4

          Please have a look at Indexes and Clusters. I think it will reduce the time from O(n) to O(log n).

          Regards, Arun Kumar.A

          R 2 Replies Last reply
          0
          • A Arun Immanuel

            Please have a look at Indexes and Clusters. I think it will reduce the time from O(n) to O(log n).

            Regards, Arun Kumar.A

            R Offline
            R Offline
            Ryan Andrus
            wrote on last edited by
            #5

            Are you refering to index's on the Database table? That is not what I am asking about. I am talking about System.Data.DataTable. If there is a way to index a System.Data.DataTable can someone please post up a how to?


            "I'm a mushroom cloud layin motherf*cker, motherf*cker!" - Marsellus Wallace from Pulp Fiction

            1 Reply Last reply
            0
            • A Arun Immanuel

              Please have a look at Indexes and Clusters. I think it will reduce the time from O(n) to O(log n).

              Regards, Arun Kumar.A

              R Offline
              R Offline
              Ryan Andrus
              wrote on last edited by
              #6

              I am asking about System.Data.DataTable not a table in the database. Do System.Data.DataTable's support index's?


              "I'm a mushroom cloud layin motherf*cker, motherf*cker!" - Marsellus Wallace from Pulp Fiction

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups