a*******y 发帖数: 199 | 1 最近在学点java,遇到个问题想请教。
首先有一个类的定义如下:
public class MinPQ implements Iterable {
private Key[] pq; // store items at indices 1 to N
private int N; // number of items on priority
queue
private Comparator comparator; // optional comparator
/**
* Create an empty priority queue with the given initial capacity.
*/
public MinPQ(int initCapacity) {
pq = (Key[]) new Object[initCapacity + 1];
N = 0;
}
/*... 阅读全帖 |
|
I*******o 发帖数: 53 | 2 SortedSet有这么一个Comparator Accessor method:
Comparator super E> comparator();
关于这个Comparator Accessor,Java tutorial里面的解释是这样的:
==================
http://java.sun.com/docs/books/tutorial/collections/interfaces/sorted-set.html
The SortedSet interface contains an accessor method called comparator
that returns the Comparator used to sort the set, or null if the set is
sorted according to the natural ordering of its elements. This method is
provided so that sorted sets can be copied into new s |
|
r*******y 发帖数: 1081 | 3 bool compare(int i, int j){
cout <<"my compare "<< i << " "<< j << " " << (i < j)<
return i < j;
}
typedef bool(*comp)(int i, int j);
int main(){
setv(compare);
v.insert(1);
v.insert(0);
}
the out put is:
my compare 0 1 1
my compare 0 1 1
It seems the compare is called twice. I think it should be only
called once. So why twice here?
Thanks. |
|
r*****l 发帖数: 2859 | 4
狭义地说,comparator()的返回值是给“别的class的”
constructor用的。不是给自己用的。所以不能是private。
maticfat解释得比较清楚了。
广义地说,comparator()的意义是告诉别人“我是怎样排序的”。
如果comparator()的返回值是null,那么这个SortedSet里面的
element必须implements Comparable(),SortedSet用Comparable()
排序。 |
|
B*****g 发帖数: 34098 | 5 I did not use sql developer for 3 years, try below, not sure will it work
for you
http://www.oracle.com/technology/products/database/sql_developer/files/featurelist_1_5.htm
Schema Diff
Compare and create SQL Difference statement between 2 schemas
Select objects to compare
Report of objects to be compared
List of differences and SQL Code to be executed
Run script output to SQL Worksheet to be executed against connection
of choice.
Or
Just compare in all_indexes table |
|
g*****g 发帖数: 34805 | 6 Sure, one usage is to check if this SortedSet has a comparator,
null means no and SortedSet falls back to Set. You may also
want to check what kind of Comparator this is, different comparator leads
to different sequence.
if(treeSet.comparator() instanceof ...) |
|
s*******u 发帖数: 2249 | 7 http://elections.foxnews.com/2008/09/09/mccain-camp-accuses-obama-of-comparing-palin-to-a-pig/
McCain Camp Accuses Obama of Comparing Palin to a Pig
John McCain’s campaign mobilized its new “Palin Truth Squad” Tuesday to
accuse Barack Obama of comparing McCain’s running mate to a pig, and called
on him to apologize.
The “Truth Squad” was announced as way for the McCain campaign to counter
attacks on Alaska Gov. Sarah Palin and consists of dozens of McCain
supporters.
The group’s first objection |
|
a******3 发帖数: 113 | 8 定义了一个class:
class classA(i:Int, s:String) extends classB(i,s) with traitA{
....
}
在新的一个class里引用了java的一个数据结构,例如ArrayList
现在创建 val al=new ArrayList[classA]()
因为classA里面没有实现Comparable,所以会报错 classA cannot be cast to java.
lang.Comparable
现在只知道改extends来实现, 但是这个classA必须要extends classB,所以classB不
能改,请问一下有什么办法实现这个comparable?
谢谢! |
|
发帖数: 1 | 9 打算用treeset实现一个最小堆。可是用了自己写的comparator以后,大数(如10000)
被认为是不同的数,因此不能去重复。请问为什么呢?
public class Test {
public static void main(String[] args) {
Set treeset = new TreeSet<>(new MyComparator());
Integer[] array = new Integer[args.length];
for (int i = 0 ; i < args.length ; i ++ ) {
array[i] = Integer.valueOf(args[i]);
treeset.add(array[i]);
}
for (Integer i : treeset) {
Syst... 阅读全帖 |
|
m******d 发帖数: 20 | 10 律师写的PL里面,主要claim了老三样,但是还列了三个comparable evidence,分别是
awards,media report,membership。有两个论文奖和news的报道,不知道单独拿出来
做comparable evidence好不好,但我想至少要把membership去掉吧。不知道这个
comparable evidence到底能不能claim?谢谢大家 |
|
I*******o 发帖数: 53 | 11 那么这就涉及2个问题了
Q1: comparator()作为public method的话,有用途么?
Q2:如果comparator()没有其他用途,实际上只是为了给constructor用一下,
却因为是interface method而不得不成为public,这个算是违反encapsulation原则了
吧?
是否有另外一个mechanicsm/pattern可以做到类似的框架,却把comparator()给封装起
来? |
|
W***o 发帖数: 6519 | 12 my 2c: the problem is with your static comparator class, because eclipse
cannot see the return value - as it is buried in the if-else blocks. I would
suggest you put the last "return 0" as a default (outside the if-else) for
the comparator method.
public int compare(Board bd1, Board bd2) {
if (bd1.manhattan() > bd2.manhattan())
return 1;
else if (bd1.manhattan() < bd2.manhattan())
return -1;
return 0;
} |
|
x*******6 发帖数: 6 | 13 小弟最近在申请博后,博士在一个偏理论组做的是comparative genomics的数据分析,
主要是细菌的,博士组里的强项是phylogenetic network,个人的生信背景偏
phylogenetics和pathway modeling多些。最近看着好多在sequencing center做NGS的
同学发了一水的牛paper,很心动。想博后往sequencing上靠靠不知有否可能,比如
assembly,resequencing,structural variation或者Chip-seq, RNA-seq之类的数据
分析。现在对这方面了解甚少。
个人觉得comparative genomics还是有很多可做,但是至今个人的paper档次很低,都
是bmc之类。而且comparative genomics做多了,觉得不是很有motivation,NGS感觉可
是说出不少临床的应用来,觉得工作更有价值些,呵呵。
一直在单枪匹马干(老板是放羊型),觉得特别吃力。工作不系统,打一枪换个地方。
老板也推荐了几个博后的组,方向都和博士比较接近,中等学校(top 10~20),4,5... 阅读全帖 |
|
c***c 发帖数: 21374 | 14 http://www.pbs.org/newshour/updates/calculator-compare-taxes-mi
The average single American is forking over about 25 percent of their
paycheck for income tax and social safety taxes — which in the U.S. include
programs like Social Security and unemployment insurance. But when compared
to other high-income nations, Americans typically are taxed on the lower
end of the scale: the U.S. ranks No. 25 out of the 34 developed nations
according to new data released Friday. The U.S. average is a few poin... 阅读全帖 |
|
发帖数: 1 | 15 Fauci urged the public not to compare the coronavirus to the seasonal flu —
because the impact of the new bug can be far worse.
Fauci urged the public not to compare the coronavirus to the seasonal flu —
because the impact of the new bug can be far worse.
“When you have a brand new virus, in which no one has had any experience
before, that kind of gives the virus an open roadway to spread,” he said.
He also warned of the infection’s alarming mortality rate.
“If you look at the people who have ju... 阅读全帖 |
|
t***o 发帖数: 462 | 16 Dem compares Obama to Jesus
Posted: 01:00 PM ET
Rep. Cohen defended Obama's community organizing on the House floor.
Rep. Cohen defended Obama's community organizing on the House floor.
(CNN) 朆arack Obama was again compared to Jesus Wednesday, but this time not
by Republicans claiming the Illinois senator has an inflated view of
himself.
Speaking on the House floor, Tennessee Rep Steve Cohen sought to defend
recent attacks over Obama's stint as a community organizer by picking up a
recent blogge |
|
l****z 发帖数: 29846 | 17 调查发现,6年前布什担任总统时,73%民主党认为总统可以影响油价,现在奥巴马是总
统,只有33%民主党认为总统可以影响油价
MRC's Tim Graham and Neil Cavuto Compare Coverage of Gas Prices (Bush vs.
Obama) on Fox News
By NB Staff | March 23, 2012 | 22:56
On Friday's Your World with Neil Cavuto on the Fox News Channel, MRC
director of media analysis Tim Graham appeared to review how the media
covered the politics and economic of gas prices under the Obama
administration as compared to the Bush administration. Fox News ran a series
of headlines showing the di... 阅读全帖 |
|
d****g 发帖数: 2 | 18 【 以下文字转载自 Overseas 讨论区,原文如下 】
发信人: DaQing (DaQing), 信区: Overseas
标 题: How to Compare and Choose Professors?
发信站: Unknown Space - 未名空间 (Fri Dec 10 22:09:01 2004) WWW-POST
I am going to transfer, but feel confused.
Do you guys know in which means can I compare two Full Professors
ACADEMICALLY?
I tried using ISI Web of Knowledge, but still can not reach a decision.
Thank you. |
|
n*******a 发帖数: 13 | 19 我们是第一次买房,用了个buyer agent.看了3次房子后对一个房子比较有兴趣, 所以
让我们的buyer agent给我们提供一个最近6个月内在那个小区里卖出的房子的
comparative market analysis.第二天就收到了她提供的信息, 见下。100 Heart St.
是我们感兴趣的房子。
100 Heart St.
The homeowner had originally purchased the property in 2004 for $XXX,000 (
base price) and they've relocated to Florida. Two comparable properties
have closed within the past 6 months:
120 Heart St. 11/26/10 Sale Price: $XXX,000
200 Heart St. 10/18/10 Sale Price: $XXX,000
感觉是她太不认真了, 这些信息我们自己在zillow上都能看到(除了这个seller 搬去
FL). 还有一... 阅读全帖 |
|
H******i 发帖数: 4704 | 20 【 以下文字转载自 Quant 讨论区 】
发信人: Helsinki (跑步然后桑拿), 信区: Quant
标 题: compare goldman and morgan bonus
发信站: BBS 未名空间站 (Thu Jan 21 11:59:16 2010, 美东)
Jan. 21 (Bloomberg) -- Goldman Sachs Group Inc., facing criticism from
politicians and labor unions for near-record compensation pools, set aside $
16.2 billion to pay employees, the smallest portion of revenue since the
firm went public in 1999.
The amount, 35.8 percent of revenue, is enough to pay each of the 32,500
employees $498,246. That compares with |
|
p**8 发帖数: 3883 | 21 Overall spending on Thanksgiving and Friday increased 2.3% over 2012 to $12.
3 billion for the two days. But Black Friday sales decreased 13.2% compared
with 2012,
//
发信人: p838 (挣钱快乐!), 信区: Stock
标 题: Re: 黑五shopping 涨了2.3%
发信站: BBS 未名空间站 (Sun Dec 1 09:00:24 2013, 美东)
But Black Friday sales decreased 13.2% compared with 2012 |
|
h******1 发帖数: 34 | 22 Compare to google? Best joke to end 2013...
After so many years, TWTR is still making a little money. Just look how many
spam users are there. Look around and see how many are using it. Even take
me
from tech industry for example, everyone (100%) around me use google and fb,
less than
10%, if not nobody, use twitter.
TWTR had been valued at less than 15B before IPO, and its valuation flatted
at that for more than 2 years before IPO.
All twitter CO-FOUNDERs already left the company. The company i... 阅读全帖 |
|
l******n 发帖数: 347 | 23 【 以下文字转载自 JobHunting 讨论区 】
发信人: luckyman (luckyman), 信区: JobHunting
标 题: anybody works for Adobe, how is it comparing to Google, FB, AMA
发信站: BBS 未名空间站 (Fri Sep 17 19:23:01 2010, 美东)
understand the growth potential from Adobe is not big as in Google, FB,
AMAZON.
But adobe was listed as the very high paid company.
How is that compared to Google, FB and AMAZON? No where near? or still
competitive? |
|
S*********n 发帖数: 895 | 24 A quick questions:
When do citation ranking, do we compare with the papers published in the
same year only, or compare with papers from all the years?
Many thx! |
|
d********g 发帖数: 290 | 25 EB1(A),10条中已满足“获奖、judge”2条证据。
申请人从事表演艺术(不是绘画、雕塑之类的实体艺术),但有重要演出经历。
想 claim “Comparable Evidence” 作为第三条证据。
提交的“Comparable Evidence” 将对应 8 CFR § 204.5(h)(3)(vii) Evidence of
the display of the alien’s work in the field at artistic exhibitions or
showcases. 很显然,这一条是专门给搞实体艺术的人留的。
不知是否可行?
希望大家给点建议,谢谢! |
|
|
g*****g 发帖数: 34805 | 27 Compare Kobe with Pippen offense
On paper, Pippen looks a little better in fg%.
But we should compare apple to apple.
1. Pippen is a small forward, as a forward you play post game,
and you are close to hoop. Guards has lower fg% than Forwards in average,
and Forwards are lower than Centers.
2. Pippen averaged 22 pts as the team's best player in 93-94, in other prime
years when he had MJ, he averaged about 20pts/game. Kobe averaged 30pts last
season. Now when you don't get that many points, you s |
|
h*d 发帖数: 19309 | 28 MS: PSN and Xbox Live not comparable News
Xbox 360 PlayStation 3 News by Tom Bramwell
Today 09:31
Microsoft has said research showing that a higher percentage of US PS3
owners have their consoles hooked up to the internet than Xbox 360 is
misleading because it does not reflect pricing or the way services are used.
"What's important to keep in mind is the level of activity over an online
service, especially when comparing a no-cost service [PlayStation Network]
to a subscription-based service lik |
|
l******9 发帖数: 579 | 29 【 以下文字转载自 JobHunting 讨论区 】
发信人: light009 (light009), 信区: JobHunting
标 题: compare two large tables SQL
发信站: BBS 未名空间站 (Thu May 8 19:33:54 2014, 美东)
I am comparing two tables to make sure they are same row by row and column
by column on SQL server.
SELECT *
FROM t1, t2
WHERE t1.column1 = t2.column1 AND t1.column2 = t2.column2
AND t1.column3 = t2.column3 AND t1.column4 != t2.column4
The tables are vey large, more than 100 million.
I got error:
ERROR [HY000] ERROR:... 阅读全帖 |
|
m******t 发帖数: 2416 | 30
Say you are writing your own SortedSetImpl, according to the contract
defined in SortedSet (see the javadoc), SortedSetImpl is supposed to have "a
constructor with a single argument of type SortedSet, which creates a new
sorted set with the same elements and the same ordering as the input sorted
set"
So in order to replicate the ordering, at some point inside SortedSetImpl(
SortedSet original) you would need to call origin.comparator() to get the
same comparator and use that to sort.
It can be |
|
r*******y 发帖数: 1081 | 31 from the output, it seems compare(0, 1) is called twice and
compare(1, 0) is not called. |
|
i****a 发帖数: 36252 | 32 【 以下文字转载自 DotNet 讨论区 】
发信人: iMaJia (iMac,iPod,iPad,i馬甲), 信区: DotNet
标 题: How to compare data in an Array and in Xml
发信站: BBS 未名空间站 (Wed Feb 8 17:25:48 2012, 美东)
I am coding in C# .NET 3.5
Let's say I have a List, and an XML file with list if items.
What I want to do is compare the values of the two lists, and get the
difference.
I want two results, 1. items in List but not in XML, 2. items in XML but
not in List.
I can only think of looping through the List against XML, and another loo... 阅读全帖 |
|
l*****0 发帖数: 179 | 33 suppose I have two groups(A,B) measuring the stock price with the same unit.
and I have a data point A1 in group A and a data point B1 in group B. The
distributions of group A and B are not known and are different.
Is there any way I can compare which point deviates larger from its group
center(mean or median)?
Assume there is no outlier, we can use (A1-mean_A)/(standard_deviation_A) .
But, I don't think we can compare the # for A1 and B1 since they are from
different distribution, can we?
Assum |
|
l******9 发帖数: 579 | 34 【 以下文字转载自 JobHunting 讨论区 】
发信人: light009 (light009), 信区: JobHunting
标 题: compare two large tables SQL
发信站: BBS 未名空间站 (Thu May 8 19:33:54 2014, 美东)
I am comparing two tables to make sure they are same row by row and column
by column on SQL server.
SELECT *
FROM t1, t2
WHERE t1.column1 = t2.column1 AND t1.column2 = t2.column2
AND t1.column3 = t2.column3 AND t1.column4 != t2.column4
The tables are vey large, more than 100 million.
I got error:
ERROR [HY000] ERROR:... 阅读全帖 |
|
c**********e 发帖数: 2007 | 35 I have a dataset, which as variable X, Y, Z, W, all continuous.
The two variables Z and W are "comparable" -- they
have the same range, similar mean, standard deviation, etc.
I would like to compare parameters of Z and of W
in the following 2 models
Y = X Z
Y = X W
Does anybody have any idea on this?
Thanks a lot! |
|
D******n 发帖数: 2836 | 36 it actually doesnt quite make sense to me to compare the coefficients of two
unrelated variables. It is more seen to compare the coefficents of the same
varialbe under different treatments.
y=b0+b1x1+b2x2+b3x1x2+e
x2 is class varialbe = 1 if in class 1, =0 in class 2
test if b3=0 |
|
l*****0 发帖数: 179 | 37 【 以下文字转载自 Quant 讨论区 】
发信人: liujx80 (xuxu), 信区: Quant
标 题: compare the deviation of data points in two different group
发信站: BBS 未名空间站 (Tue Jun 22 18:39:17 2010, 美东)
suppose I have two groups(A,B) measuring the stock price with the same unit.
and I have a data point A1 in group A and a data point B1 in group B. The
distributions of group A and B are not known and are different.
Is there any way I can compare which point deviates larger from its group
center(mean or median)?
Assume there is no out |
|
l******9 发帖数: 579 | 38 【 以下文字转载自 JobHunting 讨论区 】
发信人: light009 (light009), 信区: JobHunting
标 题: compare two large tables SQL
发信站: BBS 未名空间站 (Thu May 8 19:33:54 2014, 美东)
I am comparing two tables to make sure they are same row by row and column
by column on SQL server.
SELECT *
FROM t1, t2
WHERE t1.column1 = t2.column1 AND t1.column2 = t2.column2
AND t1.column3 = t2.column3 AND t1.column4 != t2.column4
The tables are vey large, more than 100 million.
I got error:
ERROR [HY000] ERROR:... 阅读全帖 |
|
T***U 发帖数: 2265 | 39 弃婴表卖关子
野草的鸿鹄之志展开讲讲
这个话题原来由由我老提出
中国目前通货膨胀德速度,必然导致出口成本上上升,会对中国的技术低靠廉价人力出口
经济造成什么影响?
小宝回答comparative advantage. 意思:因为中国做底端比欧美有优势,所以这个优势就
不会失去, 可以凭借这个comparative advantage垄断底端产业向西方提价.
我老没学过什么经济学,不过凭常识就觉得小宝这个讲法不work
好比你家里请个钟点工,钟点工说我比你人工便宜,比你更愿意做低级活,所以我比你有c
omparative advantage, 现在我钟点工家里条件好了,所以我胃口变大,这个工资应该由
钟点工来定!
如果我是东家, 肯定解雇it, 去市场上另找便宜的钟点工.
退一万步, 即使市场上所有的钟点工都富裕了,集体提价过高, 我老就自己做家务. 雇用
钟点工本来就是图个便宜省心. 要是钟点工敢和东家叫板, 还雇个屁啊, 家务活又不是
高技术活,东家自己也会做
是不是这个道理?
所以, 看问题不要迷信书本的忽悠, 要培养common sense
西方教育的精髓就是独立思考, 如果满足... 阅读全帖 |
|
D*V 发帖数: 3096 | 40 I give u a good exaple. Just post the prices in some Western style
restaurant in China and compare the prices of chinese restaurant in LS. and
you will have enough ammunition to attack TG. you guys are sick. |
|
w*******g 发帖数: 9932 | 41 not sure how the average is calculated.
Just FICA tax alone, you shell out ~ 11% of your income.
If you live in any state with state income tax, say 5%, that is 15% already.
Federal tax rate is more than 10% on average for sure.
include
compared |
|
l********n 发帖数: 759 | 42 【 以下文字转载自 USANews 讨论区 】
发信人: lastheaven (andvegas), 信区: USANews
标 题: 'Dibs Shame' Campaign Compares Dibs Users To Donald Trump Voters
发信站: BBS 未名空间站 (Wed Jan 20 19:53:36 2016, 美东)
trump-dibs.jpg
DIBS SHAME Kickstarter
Dibs is one of Chicago's most annoying and bizarre phenomenons. Local
Jonathan Pool has come up with a plan to make dibs participants social
pariahs by associating them with Donald Trump.
He's raising money on Kickstarter to print yard signs that read "Trump
Voters for Dibs: Becau... 阅读全帖 |
|
w**********5 发帖数: 1741 | 43 比较性宗教研究: 花13
A Short Guide to Comparative Religions
道教: Shit happens.
孔教: Confucius say, "Shit happens."
佛教: If shit happens, it isn't really shit.
禅宗: What is the sound of shit happening?
印度教: This shit happened before.
摩门教: This shit is going to happen again.
母屎林教: If shit happens, it is the Will of Allah.
思多葛主义: This shit is its own reward.
新教: Let this shit happen to someone else.
加尔文教派:Shit happens because you don't work hard enough.
五旬宗: In Jesus' name, heal ... 阅读全帖 |
|
p********m 发帖数: 195 | 44 (CNN) –Barack Obama was again compared to Jesus Wednesday, but this time
not by Republicans claiming the Illinois senator has an inflated view of
himself.
Speaking on the House floor, Tennessee Rep. Steve Cohen sought to defend
recent attacks over Obama's stint as a community organizer by picking up a
recent blogger refrain, that "Barack Obama was a community organizer like
Jesus."
The comments come days after that part of Obama's resume was belittled at
the Republican convention by both former |
|
y****t 发帖数: 10233 | 45 Chris Matthews compares obama to Gorbachev,
I love this guy...
这useful idiots看来是真傻.
hoho..
start from 1:20
|
|
l****z 发帖数: 29846 | 46 Daniel Halper
October 8, 2012 11:02 AM
Later this morning, in remarks at the Virginia Military Institute,
Republican presidential candidate Mitt Romney will say:
In Syria, I will work with our partners to identify and organize those
members of the opposition who share our values and ensure they obtain the
arms they need to defeat Assad’s tanks, helicopters, and fighter jets. Iran
is sending arms to Assad because they know his downfall would be a
strategic defeat for them. We should be worki... 阅读全帖 |
|
|
l*******z 发帖数: 90 | 48 ETC=Electronic Traction Control
may be is a subsidiary support of ESC
i compare the cars on the toyota website....
R u sure it has a filter?
I know it do have air condition
(
adjusts
firmly
, it is a standard equipment on every model of focus now. |
|
T*********s 发帖数: 20444 | 49 None can compare with rav4 |
|
e*****e 发帖数: 1570 | 50 问个在vanguard开普通mutual fund和ROTH IRA acount的问题。
首先说一下:
1,之前有ROTH IRA account,买了一些MF和ETF。后来卖了许多,现在里面没几个钱了
;账户还在;
2,现在准备放2万进去,买点Fund,总比放在银行好;
现在的问题是:我知道一般都是max ROTH IRA之后再考虑其它的长期投资;但是,我刚
错过2014-4-15的deadline,现在只能放2014年的$5,500的ROTH contribution,2013年
的放不进去了。手中2万多,如果要全部放进ROTH,那还要等好几年。
所以,我想到直接开一个vanguard普通的mutual fund account. 我做的研究,关于
vanguard普通mutual fund account的劣势(相对于Vanguard ROTH)是:
1,每年都要报税,不管是否有赢利,很麻烦;
2,no tax advantages,compared to ROTH IRA;
3,每年有20块的服务费。不过,如果sign up for electronic statements... 阅读全帖 |
|