Sets of numbers can be represented using array of 0s and 1s.

profilemathsword
 (Not rated)
 (Not rated)
Chat

 

 

Sets of numbers can be represented using array of 0s and 1s. The idea is that a[i]!=0 if iis in the set, and a[i] == 0 if it is not. For example, the array a[10] = {0, 0, 1, 0, 1, 1, 0, 0, 0, 0}wouldrepresenttheset{2, 4, 5} becausea[2],a[4],anda[5] have the value 1, and everywhere else a contains zeros. Since the array has a fixed bound, say N, the values in the set are restricted to the range 0...N-1. Write a C program that reads in two sets of numbers A and B, and calculates and print their union (

  • 10 years ago
100% correct and compiled Programm
NOT RATED

Purchase the answer to view it

blurred-text
  • attachment
    set.c.docx