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

getting unique identifier out of two variables

Hi,

given a set of pairs

P = {(x1,y1), (x2,y2), ... (xn,yn)}

where each pair is unique, is there a way to get

Q = {z1, z2, ..., zn}

that is to map each pair of values to another unique one? Is hashing the
only way to achieve this?

Regards

Josè
Jul 13 '08 #1
2 1291
Stefan Ram wrote:
»That is« is used to join two wordings with the same meaning.
This is not the case here. Moreover, your question only
mentions mathematical concepts, but shows no relation to C++.

Yes, for every set P of pairs, there exists a set Q, so that
there exists a mapping f: P -Q, so that f is injective and
f(x) != x. Proof: Map each x to the set {x}.
You must have had a very difficult childhood.

Kind Regards
Jul 13 '08 #2
Alf P. Steinbach wrote:
>
Or for example, if they're unsigned char and sizeof(unsigned int)>=2,
then let z = (unsigned(x)<<CHAR_BIT) | unsigned(y).
Hi Alf, thanks. In my case they are two unsigned int (I'm evaluating if
two size_t are better though). I was indeed considering to gather them
into a struct and overloading the < operator (as you also suggest), but
I was interested in a more low-level approach, such as the one you
describe over here. Could you expand a bit on this? Supposing I have two
uint32_t would it still possible to do something like this?

Regards

J.
Jul 14 '08 #3

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

Similar topics

18
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
4
by: ba.hons | last post by:
Hello all, Was wondering if anyone could provide some info on what could be a possible solution to a problem am having. I have to generate a Unique Identifier in C# which I will use to assign...
2
by: Ken | last post by:
Hi, I have a form whose control source is a view from SQL server 2005 database. The view has a primary key that is a unique identifier field with keys generated by newid() function from SQL server...
13
by: mliptak | last post by:
I'm trying to implement logging in my application, so that each log message has its unique identifier, e.g. log(identifier, text) What I want to achieve is that the compiler screams if the log()...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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.