subject

Read these instructions carefully to ensure your implementation is correct. Write the function odds which takes as input a linked list and modifies the input linked list to contain only the odd elements from the list. You must also return this list. The modified list must maintain the original order. Note: the input parameter is not pass-by-reference due to APT limitations, however, you are still expected to modify the incoming list, not make copies of nodes. Your linked list is represented by a pointer to a node; the node class is defined like so: class node { public: int data; node *next; }; For example, if odds is called with the list { 4,7,8, 2, 99, 34, -7} then input list must be modified to contain only { 7.99, -7). If the list would be empty, set it to nullptr. Your code must work for any valid list. Assume all libraries needed for your implementation and namespace std have already been included. Constraints For full credit, your answer must:
not create any new nodes
have no memory leaks
not use any auxiliary data structures (only nodes)
not change any data fields (only next fields)
modify the incoming list as well as return the resulting list
work for any valid list
run in O(N) time where N is the original number of nodes in the list

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
You turn your computer on and the computer will not boot up where is something you should do to diagnose the problem?
Answers: 1
question
Computers and Technology, 22.06.2019 12:40
In a response of approximately 50 words, explain why it would be essential for the successful a/v technician to participate in additional coursework, presentations and seminars offered by equipment manufacturers as well as annual conferences attended by colleagues in the industry.
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Helen is having a meeting with her colleagues in her company. they are working on the goals and objectives for the coming year. they want to ensure that these goals and objectives of the processes involved are properly evaluated. which system can helen and her colleagues apply to evaluate this? helen and her colleagues require a blank to evaluate the goals and objectives.
Answers: 2
You know the right answer?
Read these instructions carefully to ensure your implementation is correct. Write the function odd...
Questions
question
English, 31.05.2021 14:00
question
History, 31.05.2021 14:00
question
Chemistry, 31.05.2021 14:00
Questions on the website: 13722367