Advertisement
Guest User

Untitled

a guest
Feb 9th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. while true do
  2. to_test = files.first
  3. max_size = 0
  4. max_common = ""
  5.  
  6. files.each do |f|
  7. if f != to_test
  8. common = Util::longest_common_substring(to_test, f)
  9. if common.size > max_size && f.size - common.size >= mindiff
  10. max_common = common
  11. max_size = common.size
  12. end
  13. end
  14. end
  15.  
  16. print max_common + "\n"
  17.  
  18. blocks[max_common] = files.select { |s| s.include? max_common }
  19. files.select! { |s| !s.include? max_common }
  20. if files.size == 0
  21. break
  22. end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement