首页 > > 详细

辅导LookupInterface java 数据结构、java 数据结构编程解析、讲解留学生数据结构语言

/*
* An interface that you will implement in the StudentLookup class.
*/
public interface LookupInterface {

/**
* Increase the count of string s.
*
* @param amount Amount by which it is being increased.
* @param s String whose count is being increased.
*/
public void addString(int amount, String s);

/**
* Return the number of times string s has been seen.
* @param s The string we are counting.
* @return int The number of times s has been seen thus far.
*/
public int lookupCount(String s);


/**
* Get the nth most popular item based on its count. (0 = most popular, 1 = 2nd most popular).
* In case of a tie, return the string that comes first alphabetically.
* @param n Rank requested
* @return string nth most popular string.
*/
public String lookupPopularity(int n);
/**
* Return the total number of UNIQUE strings in the list. This will NOT be equal to the number of
* times increaseCount has been called, because sometimes you will add the same string to the
* data structure more than once. This function is useful when looping through the results
* using lookupPopularity. If you do lookupPopularity(numEntries()-1), it should get the least popular item.
* @return Number of distinct entries.
*/
public int numEntries();
};


 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!