Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

/** * TODO * function: filter_leq * * description: removes all elements of the given list (lst) which * are less than or equal to

/**

* TODO

* function: filter_leq

*

* description: removes all elements of the given list (lst) which

* are less than or equal to a given value (cutoff)

*

* A list containing the removed elements is returned.

*

* examples:

*

* EX1: lst: [4, 9, 2, 4, 8, 12, 7, 3]

* cutoff: 4

*

* after call:

* lst: [9, 8, 12, 7]

* returned list: [4, 2, 4, 3]

*

* -----------------------------------------

* EX2: lst: [6, 5, 2, 1]

* cutoff: 6

*

* after call:

* lst: []

* returned list: [6, 5, 2, 1]

*

* REQUIREMENTS:

*

* RUNTIME: THETA(n) where n is the length of the given list

*

* ORDERING: the ordering of the returned list should be the same as

* in the given list

*

* MEMORY: for full credit, no new nodes should be allocated or deallocated;

* you should just "re-use" the existing nodes. HOWEVER, you will

* need to allocate a LIST structure itself (i.e., for the returned

* list).

*

*/

List * filter_leq(const T & cutoff) {

return nullptr;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students explore these related Databases questions