Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

char* zigzagMerge(const char *s1, const char* s2) { /* create and return a new c-string by merging (putting in one) s1 and s2 in zigzag

char* zigzagMerge(const char *s1, const char* s2)

{

/* create and return a new c-string by merging (putting in one) s1 and s2 in zigzag form.

Example, zigzagMerge of "abc" and "defgh" will be "adbecfgh"

*/

}

bool isAnagram(const char *s1, const char* s2)

{ /* returns true if s1 and s2 contain same distinct characters apearing same number of times in both s1 and s2 otherwise returns false That is, this function returns true if s1 and s2 are permutations (re-arrangements) of same characters */ }

//Test zigzagMerge function

cout << endl;

char *s3 = zigzagMerge(s1, s2);

cout << "The zigzag merge of " << s1 << " and " << s2 << " is " << s3 << endl;

//Test isAnagram function

cout << endl;

char s4[] = "htsemsaesuatscs";

bool flag = isAnagram(s1, s4);

if (flag)

cout << s1 << " and " << s4 << " are anagrams" << endl;

else

cout << s1 << " and " << s4 << " are not anagrams" << endl;

Specifically, I am not allowed to include string, cstdlib or math libraries. Also, I am not allowed to use any built-in functions of c-strings.

here is the ideal output:

The zigzag merge of massachussettes and abmaachu is maabsmsaaacchhuussettes

massachussettes and htsemsaesuatscs are anagrams

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

Students also viewed these Databases questions

Question

4. Explain key barriers to competent intercultural communication

Answered: 1 week ago