Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hi, I need help with the function that is highlighted in yellow. In the function, I want to arrange the disks. For example, if I
Hi, I need help with the function that is highlighted in yellow. In the function, I want to arrange the disks. For example, if I have 4 dark disks and 5 light disks, I want the 5 light disks to be placed on the left side and 4 dark disks on the right side.
I don't know what to implement in order for this to happen. Please provide suggestions/tips.
I provided the hpp and cpp files below. Let me know if you need more info, Thanks.
hpp file
CPP file
class sorted_disks private: disk_state _after; unsigned _swap_count; disk_state _before; public: sorted_disks(const disk_state& after, unsigned swap_count) : _after(after), _swap_count (swap_count) sorted_disks(disk_state&& after, unsigned swap_count) : _after(after), _swap_count (swap_count) const disk_state& after) const f return after: unsigned swap_count() const { return swap count: // Algorithm that sorts disks using the left-to-right algorithm sorted disks sort_left to_right(const disk state& before) // TODO: Write code for this function, including rewriting the return / statement, and then delete these comments. return sorted-disks(before, 0)
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