`

exhaustive a char dictionary

阅读更多

May  18,2007:

May  18,2007:

        There is a sample of exhaustive a char dictionary.

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;

public class Test...{
    
public static void main(String args[])...{
        
new Test();
    }

    
    String[] chars 
= ...{"a","b","c"};        //This string array is use to stored char dictionary.
    String patternStr= "[a-z][a-z][a-z]";  //Defined regularexpression to match traverse/ergod result
    String output = "";
    Set set 
= new TreeSet();               //Set store distinct record into is reason for/why defined a tree set rather then array list.
    Pattern pattern = Pattern.compile(patternStr);
    
    
    
public Test()...{
        
int j= chars.length;
        
        
        search(
0,chars,output);
        
        
for(Iterator it = set.iterator();it.hasNext();)...{
            System.out.println(it.next());
        }

    }


    
public void search(int i,String[] chs,String output)...{
        
if(i==chars.length)...{
            Matcher matcher 
= pattern.matcher(output);
            
if(matcher.matches())...{
                set.add(output);
            }

            
return;
        }

        
for(int j =0; j<chars.length;j++)...{                 //ergod the char dictionary
            output = output+chs[j];
            search(i
+1,chs,output);
            output 
= output.substring(0,output.length()-1);
            search(i
+1,chs,output);
        }

    }

}
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.*;

public class Test...{
    
public static void main(String args[])...{
        
new Test();
    }

    
    String[] chars 
= ...{"a","b","c"};        //This string array is use to stored char dictionary.
    String patternStr= "[a-z][a-z][a-z]";  //Defined regularexpression to match traverse/ergod result
    String output = "";
    Set set 
= new TreeSet();               //Set store distinct record into is reason for/why defined a tree set rather then array list.
    Pattern pattern = Pattern.compile(patternStr);
    
    
    
public Test()...{
        
int j= chars.length;
        
        
        search(
0,chars,output);
        
        
for(Iterator it = set.iterator();it.hasNext();)...{
            System.out.println(it.next());
        }

    }


    
public void search(int i,String[] chs,String output)...{
        
if(i==chars.length)...{
            Matcher matcher 
= pattern.matcher(output);
            
if(matcher.matches())...{
                set.add(output);
            }

            
return;
        }

        
for(int j =0; j<chars.length;j++)...{                 //ergod the char dictionary
            output = output+chs[j];
            search(i
+1,chs,output);
            output 
= output.substring(0,output.length()-1);
            search(i
+1,chs,output);
        }

    }

}
 
分享到:
评论

相关推荐

    exhaustive block-matching algorithm

    一个关于matlab实现EBMA算法的程序实例

    Finding Preimages in Full MD5 Faster Than Exhaustive Search

    ### 寻找完整MD5预映像比穷举搜索更快 #### 摘要与背景 本文介绍了一种针对完整MD5散列函数的有效预映像攻击方法,该方法复杂度为\(2^{116.9}\),可以生成一个伪预映像,并且在复杂度为\(2^{123.4}\)的情况下生成...

    Categories-of-algorithmsnon-exhaustive

    Categories-of-algorithmsnon-exhaustive

    exhaustive:在Go源代码中检查枚举开关语句的穷举性-Switch source code

    exhaustive软件包和命令行程序可用于检测不详尽的枚举开关语句。 如果枚举开关语句包含每个枚举成员的用例,则它是穷举性的。 有关程序使用的枚举的定义,请参见godoc。 exhaustive软件包提供了一个Analyzer ,该...

    A Course on Rough Paths

    This book does not have the ambition to provide an exhaustive description of the theory of rough paths, but rather to complement the existing literature on the subject. As a consequence, there are a ...

    go-cve-dictionary, 创建 CVE ( NVD和日本 JVN )的本地副本 用于查询的服务器模式.zip

    dictionary, 创建 CVE ( NVD和日本 JVN )的本地副本 用于查询的服务器模式 go-cve-dictionary这是构建 NVD ( 国家漏洞数据库) [1] 和日语 JVN [2]的工具,其中包含根据用户的CVE标识符和风险得分包括exhaustive信息...

    Reconciling Exhaustive Pattern Matching with Objects

    标题《调和对象的全面模式匹配》表明这篇文章主要探讨了函数式语言中重要的模式匹配特性如何与面向对象语言中的数据抽象和扩展性进行整合。文章指出,尽管模式匹配是现代函数式编程语言的重要特性,但它与面向对象...

    Discriminative Scale Space Tracking.pdf

    Additionally, our method is computationally efficient, operating at a 50% higher frame rate compared to the exhaustive scale search. Our method obtains the top rank in performance by outperforming 19...

    a practical guide to adopting the universal verfication methodology

    The Universal Verification Methodology (UVM) is a complete methodology that codifies the best practices for efficient and exhaustive verification. One of the key principles of UVM is to develop and ...

    Deep learning for time series classification a review.pdf

    Time Series Classification (TSC) is an important and challenging problem in data mining. With the increase of time series data ...datasets, we propose the most exhaustive study of DNNs for TSC to date.

    Dynamic-vs.-Exhaustive

    在IT行业中,尤其是在软件开发和算法设计领域,"动态与详尽"通常指的是两种不同的问题求解策略,即动态规划(Dynamic Programming, DP)和穷举搜索(Exhaustive Search)。这两种方法在处理复杂问题时各有优缺点,...

    exhaustive:Annotation和Kotlin编译器插件,用于强制when语句穷举

    e: Example.kt:5: @Exhaustive when is not exhaustive! Missing branches: - RouletteColor.Green 不再需要分配给虚拟局部属性或引用无意义的函数或属性来强制when成为进行详尽性检查的表达式。 插件重用了与when...

    exhaustive-profanity-filter

    在IT行业中,尤其是在文本处理和数据清洗领域,"exhaustive-profanity-filter"是一个重要的概念,它涉及到如何有效地过滤掉不适当或冒犯性的词汇,以确保内容的适宜性和合规性。在这个项目中,我们关注的是一个...

    Swift.2.by.Example.1785882929

    Get up to speed with the new features of Swift 2 by following the exhaustive examples in this book Specialize in developing real iOS apps, and 2D and 3D videogames using Swift and Cocoapods Learn how ...

    Computer Fundamentals and Programming in C(OXFORD,2013)

    It discusses the primary functions of compilers, linkers, and loaders, and provides an exhaustive coverage of concepts such as data types, control statements, arrays, strings, functions, pointers, ...

    The_Book_of_Visual_Studio_.NET (VBL).pdf

    This book does not take an exhaustive look at any one language or technology. While you will gain new insights into these technologies, you will not learn the technologies themselves. You will, ...

Global site tag (gtag.js) - Google Analytics