View the step-by-step solution to:

Question

(Sample exam question, but too long for a real midterm.) In a C program, you have a data structure with satellite

data defined as follows:

struct my_data {

   float height;

   char *name;

   double computed value;

};


Because this is satellite data, you must access it through some other data structure. (That is, you don't have an array of just these satellite data.) Your most convenient access is through iterator functions: you can call first() to get a pointer to the first my_data structure and next() to get a pointer to the next structure. Both functions return a pointer to a my_data structure or else NULL if no more are available. Due to other processes happening at the same time, you are not guaranteed that two iterations will return the data in the same order, but each time you iterate through the data you are guaranteed to get each item exactly once.


If the height and name are already given, how can I take this satellite data, double every value and then replace the old values with the doubled ones in nlogn time with only n space.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Let our 24/7 Computer Science tutors help you get unstuck! Ask your first question.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors