Denis Yuzvyk

Greenhorn
+ Follow
since Dec 06, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Denis Yuzvyk

I have array of my classes:

MyClass [] arr = new MyClass [] {new MyClass(), new MyClass ()};

how to make shalow copy of arr?
arr.clone() will be enough?
17 years ago
I have method that perform check on input.
Something like this:

with JUnit i need check this method:


My question is:
with what value replace NAN_NUMBER ?
17 years ago
Why and what Collection implementation to hold such mapping:
1) String -> String
2) String -> Object

Thanks!
17 years ago
Oh! you are right!
at wiki says that:
The graph shown to the left has many valid topological sorts, including:

so all ok now!

Thanks!
17 years ago
but it is wrong too:

2,9,10,8,11,3,5,7
reverted:
7,5,3,11,8,10,9,2
from wiki:
7,5,3,11,8,2,9,10
17 years ago
for this grapth, i created following input:

I found such vertex and edges:
7 -> 11,8
5 -> 11
3 -> 8,10
11 -> 2,9,10
8 -> 9

so input:

but result is:
2,9,10,8,11,3,5,7
but it's wrong, coz on wiki page correct result must be


The graph shown to the left has many valid topological sorts, including:

* 7,5,3,11,8,2,9,10
* 7,5,11,2,3,10,8,9
* 3,7,8,5,11,10,9,2

17 years ago
can you please give test data?
all my attempts failed : (
may be there is bug?

May be someone can point me to implementation of this algo?

Thanks.
17 years ago
Hello,
I need implement topological sort.
I found info about this type of sorting on
http://en.wikipedia.org/wiki/Topological_sort
I write something like (code below).
But I can't test it .
According to wiki I get error that my graph is not a DAG, so a topological sort is impossible
My code below, Please with what input test it.
Thanks.
17 years ago
Tanks Sanjeev Singh.
I had second type of question.
But how to detect it? I need throw exeption if duplicates detected.
[ January 19, 2007: Message edited by: Denis Yuzvyk ]
17 years ago
Hi,
Is there any "correct" way to find duplicates at array.



Thanks
17 years ago
Thanks!
this is what i need!
17 years ago
This was 1 thing i try, but i get compilation error:

java.lang.Error: Unresolved compilation problem:
The method clone() is undefined for the type Map
if I change to:
Collections.unmodifiableMap( (Map)((Object) statistics).clone() )
i got error:
java.lang.Error: Unresolved compilation problem:
The method clone() from the type Object is not visible

According to docs, method clone available at Map implementations ...

So advice please what to do.

Thanks
17 years ago
Thanks.
unmodifiableMap - this is what i need.
Collections.unmodifiableMap(((HashMap)statistics).clone());

but i have question about clone.
How to know to which Map implementation cast statistics to call "clone()" method?
17 years ago
hi friends,

Can you please explain this:

in function "public func (java.util.Map statistics)"
task is:
Get an immutable wrapper map around the clone (using java.util.Collections)

Thans
17 years ago
i have someexpirience in java/jsp and i wonna write e-shop in educational purposes.But i don't know how to start. I think may be y can share some ideas, articles , etc ...
Thx , regards, Denis.
19 years ago