Discrete math

Z

zfareed

Can anyone suggest some resources (websites/books) to learn coding
discrete math problems?
I have a problem involving sets,relations and functions and even
though the logic is clear I dont know the syntax for inputting
relations as ordered pairs, testing for functions, compositions and
inverses etc.
 
V

Victor Bazarov

Can anyone suggest some resources (websites/books) to learn coding
discrete math problems?
I have a problem involving sets,relations and functions and even
though the logic is clear I dont know the syntax for inputting
relations as ordered pairs, testing for functions, compositions and
inverses etc.

What is your C++ question? Shouldn't you go to 'sci.math.*'?

V
 
K

Kai-Uwe Bux

Can anyone suggest some resources (websites/books) to learn coding
discrete math problems?
I have a problem involving sets,relations and functions and even
though the logic is clear I dont know the syntax for inputting
relations as ordered pairs, testing for functions, compositions and
inverses etc.

To model functions in C++, you can use std::map<>. To model relations, you
could use std::multiset<>. This assumes that you are mainly applying these
relations and functions in a forward fashion (first coordinate search is
fast, dependent variable search is linear). If you need a more symmetric
data structure, you can use two (multi)maps, one for the function/relation,
and one for its inverse. Adding a pair is done by the insert() member
function.

This might get you started. If you get stuck, post a piece of code that
demonstrates the problem.


Best

Kai-Uwe Bux
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top