Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-mainhttps://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (https://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled lettersFinding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take totoo long. A: a double forfor loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take to long. A double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

If I remember correctly, I answered a similar question yesterday Finding the given word from jumbled letters

Basically, doing permutations is going to take too long: a double for loop results in a complexity of \$O(n²)\$.

As suggested in the link, use sorting and scan linear if the output is correct or use the second approach described by thepace, which runs in \$O(n)\$

Perhaps you could run through the word file and try each word with one of the above approaches. (I believe this will run faster)

Regarding to your python code, may I suggest to use a main() function (http://stackoverflow.com/questions/4041238/why-use-def-main) and call it by using:

if __name__ == "__main__":
   main()

This is a common convention and splits your main code and your other functions in a clear way. It also prevents the code being run while it's included as a module.

goodluck!

added 93 characters in body
Source Link
DJanssens
  • 1.5k
  • 1
  • 15
  • 27
Loading
Source Link
DJanssens
  • 1.5k
  • 1
  • 15
  • 27
Loading