Inspiration

I was reminded of a program that was used to solve Jumble puzzles. The idea was sort the letters and see which ones were the same word.

What it does

This just counts the number of lines that had a high probability of being the transformed line from the original to scrambled file. The code does not currently track which line goes where, just which ones are most likely the same.

How I built it

I started by deciding which sorting algorithm to do to implement the main bulk of the work. I went with radix sort since it seemed like a fun challenge and would work the fastest. Next I worked on implementing a radix sort with ASCII characters and ended up with some very large numbers. I finished working out the problems with the sorting algorithm and compared the words with one another to see which lines were closest.

Challenges I ran into

Sorting ASCII characters was interesting as I had to convert it to base 256 to more easily handle the sorting for radix sort. This allowed for less collision between uncommon ASCII characters and would more easily sort the words. I also ran into problems when comparing the words with one another to figure out with array of words to compare with next as the string 'dad' > 'cattle', when I wanted the other way around. I solved this by writing my own compare function. However, it could have been easier to have kept the code in base 256 and then compared the letters with one another.

Accomplishments that I'm proud of

I am proud of sorting ASCII characters using radix sort, which was intended for integers and not words.

What I learned

I learned how to code using radix sort and how to tackle challenging problems. I also learned how talking about the problem with others can help you figure out the solution.

What's next for better-diff-tool_CruzHacks_2018

Next would be to track the arrays so then the user will know which array of words from the original file is the same list of words from the scrambled file. Also, I would try using merge sort or quick sort to see how much faster the different methods are.

Built With

Share this project:
×

Updates