473,394 Members | 1,946 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,394 software developers and data experts.

Duplicates in a Sorted List

I've got a new problem (making progress on my GetFiles problem).

I have a need to keep a large number of entries in a SortedList. My
challenge is that there are duplicate entries in the key. That's OK for my
application, but not for a Sorted list.

Any thoughts?

Thanks,

Tom
Nov 20 '05 #1
2 3626

You are right. SortedList does not support duplicated keys. Since I don't
know what is the exactly problem you want to resolve, I can't say what is
better data structure you can use. You can always write your own
collection to fit your application, but if you don't want to do this, one
simple solution is to put a collection (like an arrany list) into the
sortedList when you get duplicated values for a single key, and insert your
real values into that collection. You can decide whether all values in the
sortedList are collections, or only the dup items are collections, and you
do the check all the time. The first one is easy to implement, but costs
more memory. Of course, there will be some performance hit.

Thanks
Lifeng
MS VB team

Nov 20 '05 #2
Ot
I had a group of items to sort with duplicates. The sort was numbers so
this worked:

i = 0
for i = 0 to source.count - 1
key = source.key *100 + i
sorted.add(key,source.data)
next

"Tom Scales" <to****@softhome.net> wrote in message
news:nv********************@comcast.com...
I've got a new problem (making progress on my GetFiles problem).

I have a need to keep a large number of entries in a SortedList. My
challenge is that there are duplicate entries in the key. That's OK for my application, but not for a Sorted list.

Any thoughts?

Thanks,

Tom

Nov 20 '05 #3

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

Similar topics

22
by: christof hoeke | last post by:
hello, this must have come up before, so i am already sorry for asking but a quick googling did not give me any answer. i have a list from which i want a simpler list without the duplicates an...
9
by: Paul | last post by:
Can anyone suggest an efficient way to eliminate duplicate entries in a list? The naive approach below works fine, but is very slow with lists containing tens of thousands of entries: def...
8
by: Michelle | last post by:
hi, i have created an array from recordset containing user names eg. (davidp, davidp, evenf, patricka, rebeccah) which i have sorted in alphabetical order, but i need to identify duplicates...
6
by: M B HONG 20 | last post by:
Hi all - I was wondering if Javascript has a way to easily remove duplicates from a string. For example, if I had a string: "car truck car truck truck tree post post tree" it should turn...
6
by: Maxi | last post by:
I have 100 tabes in an Access database, every table has 1 filed with 100 names (records), no primary key assigned. I would like to find duplicates. Here is the criteria: The computer should...
5
by: maphew | last post by:
Hello, I have some lists for which I need to remove duplicates. I found the sets.Sets() module which does exactly this, but how do I get the set back out again? # existing input: A,B,B,C,D #...
9
by: paul.jameson | last post by:
I have a simple Access database that stores Karaoke Songlists for my local pub. From this you are able to print out the song lists they use. Up until now, any duplicate songs that appear on say,...
7
by: bonk | last post by:
Ist there a collection that holds its data sorted (i.e. inserts items sorted) AND allows to have duplicate values (by wich is sorted) ? I would like to store elements in that collection wich should...
14
by: ak | last post by:
Is it possible to find repeated(duplicate) element in an array in single loop ? AK
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.