# Visualizing MapReduce Algorithm with an Example: Finding Max Temperature

Standard

Problem Statement: Find Maximum Temperature for a city from the Input data.

File 1:

New-york, 25

Seattle, 21

New-york, 28

Dallas, 35

File 2:

New-york, 20

Seattle, 21

Seattle, 22

Dallas, 23

File 3:

New-york, 31

Seattle, 33

Dallas, 30

Dallas, 19

#### Step 2: Map Function

Let’s say Map1, Map2 & Map3 run on File1, File2 & File3 in parallel, Here is their output:

(Note how it outputs the “Key – Value” pair. The key would be used by the reduce function later to do a “group by“)

Map 1:

Seattle, 21

New-york, 28

Dallas, 35

Map 2:

New-york, 20

Seattle, 22

Dallas, 23

Map 3:

New-york, 31

Seattle, 33

Dallas, 30

#### Step 3: Reduce Function

Reduce Function takes the input from Map1, Map2 & Map3, to give an output:

New-york, 31

Seattle, 33

Dallas, 35

Conclusion:

In this post, we visualized MapReduce Programming Model with an example: Finding Max Temp. for a city.  And as you can imagine you can extend this post, to visualize:

1) Find Minimum Temperature for a city.

2) In this post, the key was City, But you could substitute it by other relevant real world entity to solve similar looking problems.

I hope this helps.

Related Articles:

Visualizing MapReduce Algorithm with WordCount Example

# I gave back at Dallas GiveCamp – And why I think every software professional should consider doing so too!

Standard

Couple of months ago, I stumbled upon a blog that had a logo of GiveCamp and the title that said “I support GiveCamp” – And curiosity got better of me and i clicked on the logo. And I landed on a page whose tagline “Coding for charity” was all I wanted to read. And I understood I would be developing a software for NGO – I was in! And (Lucky me!) there was one GiveCamp scheduled to happen in Dallas and so I signed up!

From my perspective, this is why I think it’s one of the best platforms for software professionals to volunteer:

I have volunteered at places where I paint, teach, serve food, etc – things that does not leverage what I do best.For instance, I volunteered at a place where I got to paint few walls. And since I had never painted houses before, it took me little time to figure it out and yes, I was not optimal in using paint. Now, Don’t get me wrong, I enjoy volunteering in any form – But a volunteering opportunity like GiveCamp that directly leverages what i am good at, is a Win-Win situation for me as well as the charity. So kudos to the person who came up with the idea and actually executed it. And kudos to organizers of various GiveCamp’s who must have put in countless hours to give a platform for volunteers and charities to connect and work together to create a software in short span of 48 hours!

I know! it’s an Amazing concept! Now, After my first GiveCamp – I am definitely going back next year [Update 2 Nov 2012: I volunteered at Dallas Give Camp 2012 too!] but five reasons of why I think every software professional should do so too:

– Make an impact

– Have fun

– Meet amazing campies!

– Learn things. Yes, i learned few things about WordPress that i didn’t knew before

– bag Goodies! Like books, computer hardware, magazine subscription, XBOX! etc..

And so if you have not been a part of GiveCamp, consider doing so. Even if you develop software’s on weekday’s – i bet, this experience of developing software for charity over a weekend is not just about “developing a software”. It’s much more than that…

Also don’t worry much if you are traveling from far – you can just sleep under the desk! Yes, people do that – and guess what, that is what camping is all about, isn’t it?!

And so, I had fun at this GiveCamp – And I bet you would too!

GiveCamp Site: givecamp.org

Dallas GiveCamp Site: DallasGiveCamp.org

And since this blogpost was not about what i did at GiveCamp – i leave you with our presentation:

View more presentations from Paras Doshi
And Thanks to my Team mates – i had a great time with you all!