Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you help me do this using linked lists /** * func: is_sorted * desc: we consider an option list sorted under the following conditions:
can you help me do this using linked lists /** * func: is_sorted * desc: we consider an option list sorted under the following conditions: * * - the options are in non-decreasing order of price AND * - time is used as a tie-breaker for options with identical price. * * For example, using the notationto represent an option: * * <5.1, 10.0> must be before <5.6, 9.0> (price is less, so time ignored) * <6.2, 4.1> must be AFTER <6.2, 3.9> (identical price; tie broken by * smaller time (3.9 in this case)). * * If two or more options are identical in BOTH price and time, they are * indistinguishible and must appear as a consecutive "block" if the list is * to be considered sorted. * * returns: true if sorted by the rules above; false otherwise. * * Examples: * * The option list below is sorted by our rules: * [ <1, 7>, <2, 8>, <2, 9>, <3, 5>, <5, 8>, <5, 8>, <5, 9>, <6, 12> ] * * The option list below is NOT sorted by our rules: * [ <1, 7>, <2, 8>, <4, 3>, <3, 7>] * ^^^^^^ must be before <4,3> * * The option list below is also NOT sorted by our rules: * [ <1, 7>, <2, 8>, <2, 5>, <3, 7>] * ^^^^^^ must be before <2,8> * status: TODO */ bool is_sorted()const{ return false; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started