0

I want to sort an array in nonincreasing form.Element's of this array are 4 job profits.

so that profit[i] is profit of job i.I fill this array with user input that has no order.

I must use quick sort algorithm for this purpose.This algorithm sorts my array elements

correctly but i want to job numbers(array index for each job) sort with elements

concurrently.because i don't want to change job numbers.

4
  • So.... implement quick-sort ? en.wikipedia.org/wiki/Quicksort Commented Jan 30, 2011 at 10:21
  • As usual ... what have you tried so far? Commented Jan 30, 2011 at 10:21
  • I know quick sort algoritm well.All of things that i want is: Commented Jan 30, 2011 at 10:23
  • 3
    That's a hell of a cliff hanger. Commented Jan 30, 2011 at 11:43

1 Answer 1

4

You could create Job objects that have JobNumber and Profit members, store them in an STL collection, and then sort the STL collection with STL sort.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.