anonymous
  • anonymous
need help with a computer science problem (c++)........ Write a program that reads three strings and displays the strings in all possible sequences, one sequence per output line. Display the symbol * between the strings on each line.
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
what have you done so far?
anonymous
  • anonymous
this is complex
anonymous
  • anonymous
3 words or all letter combinations?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
it says three strings, so probably just 3 "words", however strings is not necessary a word but it doesn't matter
anonymous
  • anonymous
I"m gonna have to back out of this one its time for dinner off the top of my head without writing any code i believe there are a minimum of 9 combinations.
anonymous
  • anonymous
I'd make a sudo logic table with as many combinations as i can think of and work off that.
anonymous
  • anonymous
no it's probably 6 first second third first third second second first third second third first third first second third second first however it doesn't say if you need to always use all of them, e.g. idk if you can print just one string or two strings
anonymous
  • anonymous
def permute(head,tail=[]): if len(head) == 0: printit(tail) else: for i in range(len(head)): permute(list(head[0:i])+list(head[i+1:]), list(tail)+[head[i]]) def printit(lst): for i in range(len(lst)-1): print lst[i], '*', print lst[-1] if __name__ == '__main__': permute(['this','is','test']) permute(['this','is','much','larger','test']) permute(['this']) permute(['and','another']) #since this is Python, the obligatory one-liner, if you import itertools is: #for w in list(itertools.permutations(['this','is','test'])): printit(w)
anonymous
  • anonymous
this is called a Permutations Algorithm, you have to search for it.
anonymous
  • anonymous
http://rosettacode.org/wiki/Permutations There's an entry in C++: http://rosettacode.org/wiki/Permutations#C.2B.2B
anonymous
  • anonymous
It uses lots of toys from C++ standard library though, so you might want to check out the entry on C: http://rosettacode.org/wiki/Permutations#C
anonymous
  • anonymous
agdgdgdgwngo .....thanks for those links permutations are a new method/concept for me but it mad my head spin with possible uses. Thanks again~!
anonymous
  • anonymous
thank you agdgdgdgwngo that was really helpfull, thanks all for helping
anonymous
  • anonymous
I think since there are only 3 strings they want them to do it manually, but yeah using that code is better since it works for all cases but even more better would be to create that code yourself

Looking for something else?

Not the answer you are looking for? Search for more explanations.