Answer:
See explaination
Explanation:
Diverse Subset Problem is NP: When presented with a set of k customers, it can be checked in polynomial time that you wont at any time have two customers in the set have ever bought the same product.
Independent Set is known to be NP-complete.
Independent Set ?P Diverse Subset Problem: Suppose we have a black box for Diverse Subset Problem and want to solve an instance of Independent Set. For our Independent Set Problem, we have a graph G=(V,E) and a number k, and need to find out if G contains an independent set of size (at least) k. We need to reduce the Independent Set Problem to a Diverse Subset Problem. We do this by constructing an array where each v in V is a customer and each e in E is a product, and customer v purchased every product e for which the product edge e touches the customer node v. Then we ask the black box for the Diverse Subset Problem if there is a subset of k customers that is diverse.
The black box for the Diverse Subset Problem will return.
A file with the POTX file extension is a Microsoft PowerPoint Open XML Template file used to maintain the same layout, text, styles, and formatting across multiple PPTX files.
It’s used to define the color or sound of a tone .
Answer:
#include <stdio.h>
void interchangeCase(char phrase[],char c){
for(int i=0;phrase[i]!='\0';i++){
if(phrase[i]==c){
if(phrase[i]>='A' && phrase[i]<='Z')
phrase[i]+=32;
else
phrase[i]-=32;
}
}
}
int main(){
char c1[]="Eevee";
interchangeCase(c1,'e');
printf("%s\n",c1);
char c2[]="Eevee";
interchangeCase(c2,'E');
printf("%s\n",c2);
}
Explanation:
- Create a function called interchangeCase that takes the phrase and c as parameters.
- Run a for loop that runs until the end of phrase and check whether the selected character is found or not using an if statement.
- If the character is upper-case alphabet, change it to lower-case alphabet and otherwise do the vice versa.
- Inside the main function, test the program and display the results.