473,396 Members | 1,997 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.

question on data structure

Any suggestions
which stl data structure to use if
--i need to lookup names indexed by integer idnumbers assigned
contiguously from 0 to 10000.
--if the names were indexed by SSN#?

does hashtable fit here, indexed from 1 to 10000, but before storing
into a hash table, i should order them, and then can perform binary
search on it. i guess this is most efficient or is there any other
way.

for indexed by SSn#, can have a hash().

Thanks for any help:)
Jul 22 '05 #1
4 1351
c++novice wrote:
Any suggestions
which stl data structure to use if
--i need to lookup names indexed by integer idnumbers assigned
contiguously from 0 to 10000.
std::deque <value_type>;
--if the names were indexed by SSN#?
By whom, sorry?
does hashtable fit here, indexed from 1 to 10000, but before storing
into a hash table, i should order them, and then can perform binary
search on it.
Any ordering would be destroyed anyway.
i guess this is most efficient or is there any other way.
?
for indexed by SSn#, can have a hash().


??

--
Regards,
Buster.
Jul 22 '05 #2
c++novice wrote:
Any suggestions
which stl data structure to use if
--i need to lookup names indexed by integer idnumbers assigned
contiguously from 0 to 10000.
std::deque <value_type>;
--if the names were indexed by SSN#?
By whom, sorry?
does hashtable fit here, indexed from 1 to 10000, but before storing
into a hash table, i should order them, and then can perform binary
search on it.
Any ordering would be destroyed anyway.
i guess this is most efficient or is there any other way.
?
for indexed by SSn#, can have a hash().


??

--
Regards,
Buster.
Jul 22 '05 #3

"c++novice" <be**************@yahoo.com> wrote in message
news:34**************************@posting.google.c om...
Any suggestions
which stl data structure to use if
--i need to lookup names indexed by integer idnumbers assigned
contiguously from 0 to 10000.
a vector
--if the names were indexed by SSN#?
a map

does hashtable fit here, indexed from 1 to 10000,
not really, the key word is 'contiguously', you can't get more efficient
than a vector size 10000.

[snip]

for indexed by SSn#, can have a hash().


hash would work, except its not yet an official STL data structure.

john
Jul 22 '05 #4

"c++novice" <be**************@yahoo.com> wrote in message
news:34**************************@posting.google.c om...
Any suggestions
which stl data structure to use if
--i need to lookup names indexed by integer idnumbers assigned
contiguously from 0 to 10000.
a vector
--if the names were indexed by SSN#?
a map

does hashtable fit here, indexed from 1 to 10000,
not really, the key word is 'contiguously', you can't get more efficient
than a vector size 10000.

[snip]

for indexed by SSn#, can have a hash().


hash would work, except its not yet an official STL data structure.

john
Jul 22 '05 #5

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

Similar topics

8
by: LG | last post by:
Just have a question with regards to the clipboard, and how to read what other applications (Adobe InDesignCS) place in the clipboard. I am currently in the process of creating a booklet from a...
1
by: kazack | last post by:
Hi all it's me again with another question as I got further in my book. The chapter I am in covers structres, abstract data and classes. I only read through to the end of the coverage on...
9
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? ...
1
by: Sean W. Quinn | last post by:
Hey folks, I have a question regarding file handling, and the preservation of class structure. I have a class (and I will post snippets of code later in the post) with both primitive data...
55
by: Steve Jorgensen | last post by:
In a recent thread, RKC (correctly, I believe), took issue with my use of multiple parameters in a Property Let procedure to pass dimensional arguments on the basis that, although it works, it's...
9
by: Alfonso Morra | last post by:
Hi, I am having some probs with copying memory blocks around (part of a messaging library) and I would like some confirmation to make sure that I'm going about things the right way. I have...
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
7
by: Steve Barnett | last post by:
I have a database with two tables "Structure" and "Data". The Data table contains the data for my application, so no problem there. The Structure table effectively puts some organisation to the...
27
by: karan.shashi | last post by:
Hey all, I was asked this question in an interview recently: Suppose you have the method signature bool MyPairSum(int array, int sum) the array has all unique values (no repeats), your...
26
by: Herbert Kleebauer | last post by:
As part of a simple X demo for Linux I send the byte string in "send8" to the X server. This byte string displays a circle at the x/y position send8.s8x/send8.s8y. In "display()" a 8x8 grid of...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.