Search This Blog

Friday, October 15, 2010

Java List,Set Vs Mathematics List,Set

List & Set in Mathematics with Ven diagram:

I am always wonder how mathematics are related to programming language,when i started studying java collection frame work i have found how mathematics are related to computer programming and day to day life.

Lets go to 10th standard mathematics we all love Ven diagram Problem.We all familiar with operation of Union and Intersection of two Ven diagram.

Union

Union is simply combine the value in two Ven diagram,if the value is common than its forms(Duplicate)in the List

Intersection

Intersection is always form the set because its only select the Common values for two ven diagram.

Lets take example:


For example, given A = {–2, 3, 5, 7} and B = {3, 9, 11} we see that

Union

A U B={-2,3,3,5,7,9,11}=Java List Because it has duplicate.( Array List,Vector)

Intersection

A &B={3}=Java Set because no duplicate.(HashSet,TreeSet)

When ever i got chance to work with core of programming used to co-relate programming language with Mathematics.

No comments:

Post a Comment