Code: C++ Write a very general sort method that can sort any type of data arrays/lists. For...

60.1K

Verified Solution

Question

Programming

Code: C++

Write a very general sort method that can sort any typeof data arrays/lists. For example, can sort a list of integers inascending order, a list of integers in descending order, a list ofdoubles, a list of student objects (with names and scores) inascending order of names, or in descending order of scores, … Youcan use any pre-defined sort function or can code your own. Useyour favorite language for implementation. If your language doesn’tsupport these features, implement a revised version (clearly statethe revision you made to the problem with a brief discussion of thelanguage’s weakness.) Then test the following cases:

(a) 4, 3, 7, 2, 1, 9 in ascending order

(b) 4.5, 2.0, 9.0, 8.4, 7.2, 6.1, 20.5, 2.1 indescending order

(c) John 40, Casey 45, Ben 47, Zadi 41, Kay 39, Tay 43in ascending order of names

Answer & Explanation Solved by verified expert
3.7 Ratings (434 Votes)
Solutions Integer In Asc order int arr 1 5 8 9 6 7 3 4 2 0 int n sizeofarrsizeofarr0 sortarr arrn In Desc Order int arr 1 5 8 9 6 7 3 4 2 0 int n sizeofarrsizeofarr0 sortarr arrn greater Doubles In Asc order double arr 132 5423 8234 923 6123 7324 3123 4234 2235 0235 int n    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students