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, 22.06.2019 14:30
The “rule of 72” is used to approximate the time required for prices to double due to inflation. if the inflation rate is r%, then the rule of 72 estimates that prices will double in 72/r years. for instance, at an inflation rate of 6%, prices double in about 72/6 or 12 years. write a program to test the accuracy of this rule. for each interest rate from 1% to 20%, the program should display the rounded value of 72/r and the actual number of years required for prices to double at an r% inflation rate. (assume prices increase at the end of each year.)
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
What type of file does a cookie place on web site visitors' computers so that web site managers can customize their sites to their visitors' preferences?
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
What is a programming method that provides for interactive modules to a website?
Answers: 1
You know the right answer?
Read these instructions carefully to ensure your implementation is correct. Write the function odd...
Questions
question
English, 27.01.2020 20:31
question
Mathematics, 27.01.2020 20:31
Questions on the website: 13722359