Questions tagged [anagram]

A word, phrase, or name formed by rearranging the letters of another, such as cinema, formed from iceman.

531 questions
3
votes
2 answers

Separate different anagrams

Suppose I have certain number of strings, say n, stored in random order in an array. A few, say m1, are anagrams of string1 and m2 are anagrams of string2 and so on. What would be an efficient algorithm to separate out strings that are anagrams of a…
Bhavuk Mathur
  • 1,048
  • 1
  • 12
  • 22
3
votes
1 answer

Anagrams - Hashing with chaining and probing in C

My title got edited, so I wanted to make sure everyone knows this is homework. The problem is just to optimize the program, the hashing is my idea. -- I'm working on optimizing a C program that groups together words that are anagrams of each other,…
user677786
  • 455
  • 1
  • 6
  • 13
3
votes
3 answers

Algorithm to find anagrams Objective-C

I've got an algorithm to find anagrams within a group of eight-letter words. Effectively it's alphabetizing the letters in the longer word, doing the same with the shorter words one by one, and seeing if they exist in the longer word, like so: tower…
Luke
  • 9,512
  • 15
  • 82
  • 146
3
votes
4 answers

is this the best anagram checking solution?

I am looking for an efficient solution to check if two strings are anagrams, but char table/dictionary checking may not be a good solution for unicode. I have come up a solution, but I don't know how to prove it mathematically correct. The formula…
3
votes
6 answers

How do I create subset words for an anagram application (php)?

I created an anagram creating application, by creating an anagram field in my database, with a lower cased alphabetically stored string. For example, suction becomes cinostu, ear becomes aer, and so on. What I want to do now is create sub words from…
Andy
3
votes
6 answers

Anagram Algorithm in PHP

I'm totally a newbie with PHP. Today I just got a problem that I can't know how to solve, even after searching google and digging SOF. It's the Anagram algorithm. So basically, I understand the problem here : When user input a string, I split it and…
khiemnn
  • 115
  • 2
  • 3
  • 13
3
votes
2 answers

How do I find words that only contain/consist of a given char sequence

I wish to loop through a dictionary file and find words that contain only the given characters Example dgo Desired results: dog, god NOT words that contain (within them) the given characters I am working with the following code: …
stackoverflow
  • 18,348
  • 50
  • 129
  • 196
3
votes
4 answers

Mysql multiple queries for anagram solver

I have a simple but huge table called 'dictionary' which has 2 columns. Id and word. I have a php anagram algorithm tha creates all possible combinations of a given word. I want to chech if that word exists in my dictionary and if yes display it.…
Nicos
  • 303
  • 2
  • 19
3
votes
2 answers

Script returns same value multiple times

Basically I have a script in Python that takes several letters, gets every combination of them and then checks to see if it's an actual word (Think scrabble in a way) but for some reason it returns the same words multiple times which I don't want it…
Coombes
  • 203
  • 1
  • 10
2
votes
1 answer

Every combination of character array

Having problems trying to show every combination of a character of array without repeating letters. public static String[] getAllLists(String[] elements, int lengthOfList) { //initialize our returned list with the number of elements calculated…
Lemex
  • 3,772
  • 14
  • 53
  • 87
2
votes
4 answers

Ruby Anagram Using String#sum

I've solved a problem that asks you to write a method for determining what words in a supplied array are anagrams and group the anagrams into a sub array within your output. I've solved it using what seems to be the typical way that you would which…
Caley Woods
  • 4,707
  • 4
  • 29
  • 38
2
votes
1 answer

resize uiview subclass after creation

Is there a quick and easy way to resize a UIView after creating it and have its subviews resize also? I have a custom UIView subclass called AnagramLetter, the implementation and interface code for which is shown below: @interface AnagramLetter :…
Bob-ob
  • 1,560
  • 4
  • 18
  • 34
2
votes
2 answers

How would you sort strings such that the anagrams are close to each other in C++?

It'd be really to implement in Java, since you could use the Comparator and the built in methods to sort character arrays and compare strings like this: public class AnagramComparator implements Comparator { public String sortChars(String…
GrowinMan
  • 4,891
  • 12
  • 41
  • 58
2
votes
3 answers

Anagram function returns False for unknown reason in some words - Python

I've tried to create a function that returns True if two words are anagrams (have the same letters) to each other. I realized that my counter counts to 13 but not sure what is the issue. def is_anagram (worda: str , wordb: str) -> bool: …
Yael Chen
  • 23
  • 2
2
votes
1 answer

Group Anagrams - LeetCode

Today I came across a solution for this problem: https://leetcode.com/problems/group-anagrams/submissions/ The author used AbstractList to solve this problem. And the solution looks somewhat like this import java.util.AbstractList; class Solution…
ZodiacLeo123
  • 115
  • 2
  • 8