java - Checking if two strings are permutations of each other -


To determine whether two strings are permutations of each other

< Div class =

  • Compare the results to see if they are the same.
  • Edit:

    The above method is quite efficient - O (n * log (n)) and, as shown by others Is the standard java API Even more efficient (but more than that) the calculation and comparison of the occurrence of each character, will be used as an index of values ​​in the form of an index.

    I do not think this is an effective way of doing this recursively

    • If both strings meet the same character, then the correct return
    • Otherwise: <
    • Remove a letter from the first letter
    • View the second string for the occurrence of this character
    • If it does not exist then False return
    • Otherwise, delete the deleted character and apply the rearranged algorithm to those who have two strings Please.

    Comments

    Popular posts from this blog

    oracle - The fastest way to check if some records in a database table? -

    php - multilevel menu with multilevel array -

    jQuery UI: Datepicker month format -