## RayvenHawk 22

I have a homework assignment for my algorithms class, we need to take up to 10 user inputted locations and then plot out the route from a static point, displaying every possible route to take.

What I'm wondering is is there a way to randomly display a string array and avoiding duplicates?

I know how to randomize an int array, but that deals with numbers only.

Thanks.

## Lerner 582

>>What I'm wondering is is there a way to randomly display a string array and avoiding duplicates?

If I have an array of x unique strings I could write code to display all x strings randomly, but display each string only one time, yes. If that's what you are asking.

I can also display all elements in an array in all possible unique combinations if that's what you mean.

## RayvenHawk 22

>>What I'm wondering is is there a way to randomly display a string array and avoiding duplicates?

If I have an array of x unique strings I could write code to display all x strings randomly, but display each string only one time, yes. If that's what you are asking.

I can also display all elements in an array in all possible unique combinations if that's what you mean.

Displaying them in all possible unique combinations is what I'm looking for. Can you give an example of how to accomplish it?

Displaying them in all possible unique combinations is what I'm looking for. Can you give an example of how to accomplish it?

You're asking for a solution to your homework? I'll give you a hint: Depth First Search.

## WaltP 2,905

You're asking for a solution to your homework? I'll give you a hint: Depth First Search.

Only good for a tree. I think you mean Permutations.

Only good for a tree. I think you mean Permutations.

Or good for a graph. Suppose that the cities are a fully connected graph ( which it sounds like they are ), then doing a depth first traversal of the graph from each node will render every possible permutation.

## RayvenHawk 22

Duskreader - thanks for the tip, the depth first traversal is a method covered in my text so that'll work for what I need.

Now on a side note, I really wasn't asking for anyone to *DO* the work, I just needed a simple example of doing a random output of string arrays. I wasn't really sure if the same function used for INT arrays also covered other types as well.

## RayvenHawk 22

"One of the most frightening things about your true nerd, for may people, is not that he's socially inept - because everybody's been there - but rather his complete lack of embarrassment about it."
--Neal Stephenson .

Just to be a grammar police here, but you forgot the "n" in many "for maNy people."