Group members: Arqum Ahmed and Yesh Patel
Objective: You have a row of 2𝑛 disks of two colors,𝑛 dark and 𝑛 light. They alternate: dark, light, dark, light, and so on. You want to get all the dark disks to the left-hand end, and all the light disks to the right-hand end. The only moves you are allowed to make are those that interchange the positions of two neighboring disks. Design an algorithm for solving this puzzle and determine the number of moves it takes.
-
disks.hpp is a C++ header that defines functions for the two algorithms described above. There are also classes that represent the input and output of the alternating disk problem. The function definitions are incomplete skeletons; you will need to rewrite them to actually work properly
-
disks_test.cpp is a C++ program with a main() function that performs unit tests on the functions defined in disks.hpp to see whether they work, prints out the outcome, and calculates a score for the code. You can run this program to see whether your algorithm implementations are working correctly.
Implement all the skeleton functions in disks.hpp. Use the disks_test.cpp program to test whether your code works.