473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

Jul 13 '07 #1
5 1676
I don't believe it is possible to guarantee processing time in Windows
environment.

Because search time depends on data size you can't guarantee constant time
when searching either. You can hope to have more or less same time when your
data has fixed size. But there will be no guarantee.

I believe fastest way is by row index. But also no guarantee for processing
time.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:97**********************************@microsof t.com...
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

Jul 13 '07 #2
I don't believe it is possible to guarantee processing time in Windows
environment.
arrays don't provide constant access time? that seems wrong to me. I think
it is possible, if nothing else you could do it in unmanaged C++ but I would
be very supprised if arrays didn't offer constant time access.
I believe fastest way is by row index. But also no guarantee for processing
time.
can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...

thanks
"AlexS" wrote:
I don't believe it is possible to guarantee processing time in Windows
environment.

Because search time depends on data size you can't guarantee constant time
when searching either. You can hope to have more or less same time when your
data has fixed size. But there will be no guarantee.

I believe fastest way is by row index. But also no guarantee for processing
time.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:97**********************************@microsof t.com...
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


Jul 13 '07 #3
You need to factor in other processes and threads, OS kernel etc.. Any
thread could be interrupted at arbitrary moment.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:34**********************************@microsof t.com...
>I don't believe it is possible to guarantee processing time in Windows
environment.

arrays don't provide constant access time? that seems wrong to me. I think
it is possible, if nothing else you could do it in unmanaged C++ but I
would
be very supprised if arrays didn't offer constant time access.
>I believe fastest way is by row index. But also no guarantee for
processing
time.

can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...

thanks
"AlexS" wrote:
>I don't believe it is possible to guarantee processing time in Windows
environment.

Because search time depends on data size you can't guarantee constant
time
when searching either. You can hope to have more or less same time when
your
data has fixed size. But there will be no guarantee.

I believe fastest way is by row index. But also no guarantee for
processing
time.
"Ryan Andrus" <Ry********@discussions.microsoft.comwrote in message
news:97**********************************@microso ft.com...
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



Jul 13 '07 #4
On Fri, 13 Jul 2007 08:14:04 -0700, Ryan Andrus
<Ry********@discussions.microsoft.comwrote:

>can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...
Are you familiar with Lutz Roeder's Reflector? It allows you to
decompile assemblies, including the supplied .Net ones, and examine
the code. The DataRowCollection is implemented in terms of a red-black
tree.
--
Philip Daniels
Jul 13 '07 #5
Thanks Philip,

So, as far as you know is DataTable.Row[<index>]

The quickest access method resulting in O(log n) complexity?

"Ph***********@foo.com" wrote:
On Fri, 13 Jul 2007 08:14:04 -0700, Ryan Andrus
<Ry********@discussions.microsoft.comwrote:

can someone please at least speak to the Big O analasys of this access or
point me to what algorythm is used so that I can calculate it. Is it a b
tree, linked list, etc...

Are you familiar with Lutz Roeder's Reflector? It allows you to
decompile assemblies, including the supplied .Net ones, and examine
the code. The DataRowCollection is implemented in terms of a red-black
tree.
--
Philip Daniels
Jul 13 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Josema | last post by:
Hi, I would like to know how fill a datatable from a two dimensional array. Any advice will be grateful. -- Thanks a lot. Regards.
15
by: Marcus | last post by:
I created a VB.Net 1.1 application that iterates through all the tables in any basic Access 2000 database passed to it and generates the same table structure in a SQL Server Express database. The...
3
by: Tigger | last post by:
I have an object which could be compared to a DataTable/List which I am trying to genericify. I've spent about a day so far in refactoring and in the process gone through some hoops and hit some...
4
by: oopman2002 | last post by:
I have created a DataSet DataTable which is comprised of data from a number of sources. The resultant datatable is about 500,000 records and writing them out one at a time takes forever. Does...
0
by: =?Utf-8?B?UnlhbiBBbmRydXM=?= | last post by:
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...
7
by: =?utf-8?B?5YiY5piK?= | last post by:
Hi, folks, Is it possible to delete an element from a sorted array with O(1) time? Best regards
3
by: Martin Frey | last post by:
Hello guys, im new to asp.net and im trying to get me used to it. I've managed to create webpages with detailviews, databinding and datasources. Adding or inserting data went very well and, after...
10
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Problem: How can I databind (or put) a SqlServer query's row return of 115,000 items into a ComboBox quickly? Not much longer than a matter of seconds, that is... Scenario: I am...
5
by: yarivot26 | last post by:
I'm using ODBC to read a office access db the db have almost 10,000 rows so I want to split it into pages The first page load nice and quick, but in other pages i get: Maximum execution time...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.