Display all subsets of the characters

Assignment Help Computer Engineering
Reference no: EM132194681

Write a C++ program called all_subsets.cpp which displays all subsets of a set. In the problem, your program should read n characters from a user and display all subsets of the characters.

In the program, you can assume that the number of input characters is less than or equal to 15.

Your program should ask a user to enter the number of input characters.

After that, it should read the characters.

For the problem, you can assume that the input characters are always distinct.

The following presents a sample run of the program:

Number of input characters: 2

Enter 2 characters: a c

===== All Subsets =====

empty

{c}

{a}

{a,c}

At the above sample run, the sequence of subsets is not important. Therefore, this result is also fine.

Number of input characters: 2

Enter 2 characters: a c

===== All Subsets =====

{a,c}

empty

{c} {a}

[Hint]: You can use the binary representation of the numbers from 0 to 2n - 1 for the input n. For example, if the number of input characters is 2, all binary numbers from 0 to 22 - 1 (= 3) will be 00, 01, 10, and 11. Try to find a correspondence between a subset and its binary representation.

This is another sample run:

Number of input characters: 3

Enter 2 characters: c d f

===== All Subsets =====

empty {f}

{d}

{d,f}

{c}

{c,f}

{c,d}

{c,d,f}

Reference no: EM132194681

Questions Cloud

Supporters of a higher minimum wage : Why do you think organized labor groups, such as unions, are supporters of a higher minimum wage, even though all of their members earn much more
Ask the user to input the number of rows and columns : The program will fill the arry starting at location [0][0] with the user selected starting number and each element after will be incremented by the user direct.
How a change in the exchange rate affected firm : Describe how a change in the exchange rate affected your firm. Explain what happened to your price and quantity.
Elasticity of demand for a given product or services : What are the two primary factors that determine the elasticity of demand for a given product or services?
Display all subsets of the characters : n the problem, your program should read n characters from a user and display all subsets of the characters.
Explain consistent patterns in feelings and behaviour : HPS307/791 PERSONALITY ASSESSMENT, DEAKIN UNIVERSITY, AUSTRALIA. Explain consistent patterns in thoughts, feelings and behaviour
How it distinguishes normal and inferior goods : Define income elasticity and how it distinguishes normal and inferior goods.
A program to count words and numbers in a plain text file : Words and numbers can be repeated. You can use any algorithm and data structures that you prefer, as long as the results are correct.
A program to calculates a vehicles gas mileage : The program should ask the user to enter the number of gallons of gas the vehicle can hold and the number of miles it can be driven on a full tank.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write the class declarations and the constructors

Write the class declarations, the constructors, and the methods to String for all classes. Supply a test program that tests these classes and methods.

  Three concerns dealing with internet security and privacy

identify and define three concerns dealing with Internet security and privacy?

  Describe one application relevant for ig based energy system

IGs need dc-ac, ac-dc, and ac-ac converters. Describe one application, relevant for IG-based energy system, for each of those power conversions.

  Prepare data flow diagrams which use only a few symbols

"It is easier to learn to prepare data flow diagrams, which use only a few symbols, than it is to learn to prepare flowcharts, which use a number of different symbols." Discuss.

  Write a c function that inputs a pointer to a string

Write a C function that inputs a pointer to a string and a pointer to a buffer. The function then scans through the string removing leading and trailing.

  How does your style impact the technological tools

Here is an assessment on Leadership Style. Please take this assessment and provide an analysis of the results. How does this relate to you?

  How many botnet machines are needed to send data

How many botnet machines are needed to send data to the web server in order to fill the web server's link capacity?

  Design and implement a class matrixtype

Design a to perform various matrix operations. class A matrix is a set of numbers arranged in rows and columns. Therefore, every element of a matrix has a row position and a column position.

  Write a business case for the new hwe accessories website

Write a 2- to 3-page business case for the new HWE Accessories website using Microsoft Word. Include the problem statement and Analysis of the situation.

  Comprehensive non statistical attributes sampling

Marty Alewine, a newly promoted senior at your firm, has been assigned as in charge of the audit of Doxey Electronics. Doxey has been a client of your firm.

  Write a program that create and prints a random phone number

Write a program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. Do not let the first three digits.

  Compare design and layout of an android phone application

Compare and contrast the design and layout of an Android phone application with that of a traditional desktop application.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd