Which sorting algorithm can be used to get nearer and approximate matching list with given string
input:
- list of strings
- tobesearch_str
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
My understanding of what it is you want to do is as follows:
One way of measuring how close two strings are is the edit or Levevshtein distance. There is a page on the TCL wiki that gives a TCL implementaion of this algorithm. What you can then do is create a list of lists where each sub-list contains you candidate string and its distance from the search string. The code below shows how sort this list using the lsort command:
This results in the following output:
Is this the kind of thig you are after or have I misinterpreted what you are trying to do?