选择如何以扼杀方式进行工作? 我做了一些搜索,似乎无法找到一个明确的答案。 如果我有4个名字[Rob, Adam, Tom, Thomas]——如何选择这些名字? 这只是一封信吗? 如果是的话,它就喜欢:[Adam, Rob, Thomas, Tom]。
感谢。
选择如何以扼杀方式进行工作? 我做了一些搜索,似乎无法找到一个明确的答案。 如果我有4个名字[Rob, Adam, Tom, Thomas]——如何选择这些名字? 这只是一封信吗? 如果是的话,它就喜欢:[Adam, Rob, Thomas, Tom]。
感谢。
所有分类算法都使用某种比较功能来确定要素顺序。 它一般独立于你选择的特定分类算法。
多数语言试图根据分类的数据类型来猜测比较功能。 例如,比较数字只是检查数量越多。 http://en.wikipedia.org/wiki/Lexicographical_order” rel=“nofollow”>dictionary Order,其中比较了连续的信函。 一些实例(GT - 大于,LT - 少于:
比较数字:
> compare 1 2
LT
信:
> compare R A
GT
说明(比较内部信函,思考如何):
> compare "Rob" "Adam"
GT
职业介绍职能使用这种内部比较([1,2,3]是三个数字的清单)。 你们不知道内部使用哪一种算法,但只要使用同样的比较功能,结果就应当有所改动:
> sort [3,1,2]
[1,2,3]
> sort [ t , h , o , m , a , s ]
[ a , h , m , o , s , t ]
> sort ["Rob", "Adam", "Tom", "Thomas"]
["Adam","Rob","Thomas","Tom"]
你们甚至可以确定自己的比较功能,以某种更复杂的标准分类:
按主要分歧因素分列的数字清单。
第一个海关比较功能:
> numOfPrimeDivs 30
3
> numOfPrimeDivs 6
2
> let compareNumOfPrimeDivs n1 n2 = compare (numOfPrimeDivs n1) (numOfPrimeDivs n2))
> compareNumOfPrimeDivs 30 6
GT
> sortBy compareNumOfPrimeDivs [2,210,30,2310,6]
[2,6,30,210,2310]
体内长
比较职能:
> length "Rob"
3
> length "Adam"
4
> let compareLength s1 s2 = compare (length s1) (length s2)
> compareLength "Rob" "Adam"
LT
> sortBy compareLength ["Rob", "Adam", "Tom", "Thomas"]
["Rob","Tom","Adam","Thomas"]
I have an enum class like the following: public enum Letter { OMEGA_LETTER("Omega"), GAMMA_LETTER("Gamma"), BETA_LETTER("Beta"), ALPHA_LETTER("Alpha"), private final String ...
There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...
So, i have a two-dimensional Array of ID s and vote count - voteArray[i][0] = ID, voteArray[i][1] = vote count I want the top 3 voted items to be displayed in different colors, so i have a 2nd Array -...
I m working with a set of legacy DAO code that returns an IList, where each Hashtable represents the row of a dynamically executed SQL query. For example, the List might contain the following records/...
Stuck on an array sorter. Have to sort numbers from largest to smallest. I m trying two loops (one nested in the other). Here s the code: int counter=0; // inner counter int counter2=0; // outer ...
This doesn t seem to work as I intend. VB.NET: Dim x = Model.Discussions.OrderByDescending(Function(d) d.Messages.OrderByDescending(Function(m) m.Sent).First.Sent) For Each d As Discussion In x ....
I m looking for a way to sort my elements, but it isn t as easy as it sounds. Please let me explain My elements are grouped per 6 elements (thumbnails), each x represents a thumbnail However all ...
I m working on a game like Rodents Revenge, just to point out where I m coming from with this question. I m using the cocos2d game engine aswell... I have a layer that contains about 168 blocks, ...