0
$\begingroup$

So, I came across an interesting scenario and I got stuck. Is there a way to build a generic equation to represent a transformation of a data-set. I'm not sure what specific tags this should be under. If I need to select different tags please let me know.

The specific scenario is:

Given an unsorted data-set, sort it, then return a list of the count of the repeat elements.

I have code to perform this, but I'm wondering if there might be a generic equation to represent the transformation. Having this generic process, how would I create an equation to represent this pattern?

Examples:
A [1,2,1,4,1,3,4,2,5,5] -> B [1,1,1,2,2,3,4,4,5,5] -> C[3,2,1,2,2] 
A [4,4,5,5,2,1,6] -> B[1,2,4,4,5,5,6] -> C[1,1,2,2,1]

Even more ideal, given an equation which outputs the data-set, perform the transformation. Though, I would be more than happy with just the transformation itself as it would allow me to move past this brick wall I've had for the past 6 months. Just a hint of what to study even would be greatly helpful.

Thank you.

$\endgroup$
  • 1
    $\begingroup$ What do you mean by "generic equation to represent the transformation"? Are you looking for an algorithm to solve your problem in one step (from A to C) instead of two (A to B then B to C)? $\endgroup$ – wece Oct 17 '16 at 9:18
  • $\begingroup$ No, I am meaning a generic equation in the form, C = Transform(B). $\endgroup$ – Erick Stone Oct 17 '16 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.