The Ham Supper You're at a holiday supper where the hosts are serving far too much ham. After the supper, you're asked to take care of cleaning the dishes. However, one of your relatives tells you that the dishes can only be cleaned in the sink if their ham-ing distance is the length of the input serial number when compared with all other dishes, otherwise, they can be cleaned in the dish washer if any distance is less than the length of the serial number. A ham-ing distance is a count of the numbers that are different in the same positions. The ham-ing distance can be found by comparing the serial numbers of each of the dishes. For instance, two cups have serial numbers 0010, and 1214 meaning they have a hamming distance of 3. Therefore, they they be cleaned in the dish washer. With an additional plate that has a serial number of 3897, it would need to be cleaned in the sink as it's hamming distance is 4, or equal to the length of the serial numbers when compared to the others. The input list given with this assignment can be used to find all the serial numbers of all the dishes. Provide general code that computes, and outputs the sum of the serial numbers to be cleaned in the dish washer, and the sum of the serial numbers to be cleaned in the sink. Additionally, provide code that is specific to this input which can find the sums with a linear time complexity O(n), where n is the number of elements in the input list. Testing Include testing for this specialized code, as well as the generalized code. There are no specific guidelines for testing. However, they should probe edge cases, and be triggered automatically when the main function is run.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question

Can yo do this in C++, here are the input  : 41360114 48648110 11036224 83620684 11806064 22036266 66830416 44168838 41664810 36310244 83033068 03631826 46112613 06831181 12200621 03846661 11141362 04624101 82340210 30634203 38034162 68036462 02614316 08800136 83688326 40602830 63321231 81044114 20012082 21014838 21081200 36068048 64120020 32311142 42400042 86322306 68108012 20380100 43116446 13323000 44080311 16411816 32020468 42838624 88826006 28360306 30822218 13683682 04801288 10428026 23386111 33113860 02288384

The Ham Supper
You're at a holiday supper where the hosts are serving far too much ham. After the supper,
you're asked to take care of cleaning the dishes. However, one of your relatives tells you that
the dishes can only be cleaned in the sink if their ham-ing distance is the length of the input
serial number when compared with all other dishes, otherwise, they can be cleaned in the dish
washer if any distance is less than the length of the serial number. A ham-ing distance is a
count of the numbers that are different in the same positions. The ham-ing distance can be
found by comparing the serial numbers of each of the dishes.
For instance, two cups have serial numbers 0010, and 1214 meaning they have a hamming
distance of 3. Therefore, they they be cleaned in the dish washer. With an additional plate that
has a serial number of 3897, it would need to be cleaned in the sink as it's hamming distance is
4, or equal to the length of the serial numbers when compared to the others.
The input list given with this assignment can be used to find all the serial numbers of all the
dishes. Provide general code that computes, and outputs the sum of the serial numbers to be
cleaned in the dish washer, and the sum of the serial numbers to be cleaned in the sink.
Additionally, provide code that is specific to this input which can find the sums with a linear time
complexity O(n), where n is the number of elements in the input list.
Testing
Include testing for this specialized code, as well as the generalized code. There are no specific
guidelines for testing. However, they should probe edge cases, and be triggered automatically
when the main function is run.
Transcribed Image Text:The Ham Supper You're at a holiday supper where the hosts are serving far too much ham. After the supper, you're asked to take care of cleaning the dishes. However, one of your relatives tells you that the dishes can only be cleaned in the sink if their ham-ing distance is the length of the input serial number when compared with all other dishes, otherwise, they can be cleaned in the dish washer if any distance is less than the length of the serial number. A ham-ing distance is a count of the numbers that are different in the same positions. The ham-ing distance can be found by comparing the serial numbers of each of the dishes. For instance, two cups have serial numbers 0010, and 1214 meaning they have a hamming distance of 3. Therefore, they they be cleaned in the dish washer. With an additional plate that has a serial number of 3897, it would need to be cleaned in the sink as it's hamming distance is 4, or equal to the length of the serial numbers when compared to the others. The input list given with this assignment can be used to find all the serial numbers of all the dishes. Provide general code that computes, and outputs the sum of the serial numbers to be cleaned in the dish washer, and the sum of the serial numbers to be cleaned in the sink. Additionally, provide code that is specific to this input which can find the sums with a linear time complexity O(n), where n is the number of elements in the input list. Testing Include testing for this specialized code, as well as the generalized code. There are no specific guidelines for testing. However, they should probe edge cases, and be triggered automatically when the main function is run.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Huffman coding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole