0
$\begingroup$

I've been asked to define a function getEmployees that maps each role into the set of names who have that role within a business. I need to define both the type and mapping of this function.

So say I have a few sets - {Checkout}, {Manager}, {Shelf Stacker}, and say I have one name in each, maybe {John Doe} intersects both {Checkout} and {Shelf Stacker}.

I'm just a bit confused with what is meant by type, I thought they may mean to write the function, map it, and state whether it's surjective, injective etc?

I've just been told "no that's not the case..but I'm not saying any more!"

Could someone please help me try to figure this out? Or point me in the right direction? I'm lost!

$\endgroup$
2
  • $\begingroup$ Are you sure that your question is about Matehmatics? $\endgroup$ Nov 29, 2018 at 19:56
  • $\begingroup$ @TitoEliatron Discrete Maths within Comp Sci - sorry for the grey area $\endgroup$
    – CerKL
    Nov 29, 2018 at 20:00

1 Answer 1

2
$\begingroup$

Let $E$ denote the set of employees and $R$ the set of roles, and $X$ the set of ordered pairs $(e,\,r)$ with $e\in E,\,r\in R$ such that $e$ has role $r$. The getEmployees method is $r\mapsto\{e\in E|(e,\,r)\in X\}$. Similarly, a getRoles method would be $e\mapsto\{r\in R|(e,\,r)\in X\}$.

$\endgroup$
2
  • 1
    $\begingroup$ Thanks for this! I was tripping up over the method, could you please help me figure out what they might mean by "define the type" though? $\endgroup$
    – CerKL
    Nov 29, 2018 at 20:15
  • 1
    $\begingroup$ @CerKL Presumably the types of an employee are that employee's roles. The term "type" in this context might have meant the type of a variable in programming, e.g. List<Role> or any number of similar things in C#. $\endgroup$
    – J.G.
    Nov 29, 2018 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .