Skip to content

Instantly share code, notes, and snippets.

View rajkumar-p's full-sized avatar

Rajkumar rajkumar-p

View GitHub Profile
@rajkumar-p
rajkumar-p / hello_world.cpp
Last active August 7, 2019 14:09
Hello World
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hello World!!!" << std::endl;
return 0;
}
@rajkumar-p
rajkumar-p / Ratings.pl
Created August 5, 2011 13:27
Perl script to find the highest rated movie each year
#!/usr/bin/perl -w
use strict;
sub trim($) {
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
@rajkumar-p
rajkumar-p / imdbrating.java
Created August 5, 2011 13:30
MapReduce job to find the highest rated movie each year
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import java.io.IOException;
@rajkumar-p
rajkumar-p / about.md
Created August 9, 2011 16:11 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@rajkumar-p
rajkumar-p / pointer_expressions.cpp
Created September 10, 2011 04:38
Pointer Expressions
#include <iostream>
using namespace std;
int main() {
// Define a int variable
int i = 5;
// Declare a pointer which can point to a int
int *i_ptr;
// Make i_ptr point to i
i_ptr = &i;
@rajkumar-p
rajkumar-p / ptr2ptr_funcptr.cpp
Created September 10, 2011 08:12
Pointer to a Pointer & Function Pointers
#include <iostream>
using namespace std;
int main() {
int i = 5;
int *i_ptr = &i;
// A pointer to pointer is declared as below
int **i_ptr_ptr;
@rajkumar-p
rajkumar-p / func_pointers.cpp
Created September 15, 2011 13:10
Function Pointers
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
int main() {
// Integer elements to be sorted
int i_arr[] = {5, 20, 3, 96, 37, 12, 2, 56, 39};
// Integer comparison function prototype
@rajkumar-p
rajkumar-p / pointers_functions.cpp
Created September 27, 2011 14:22
Passing pointers to functions
#include <iostream>
using namespace std;
int main() {
int numbers[] = {14, 82, 76, 90, 12, 84};
// Function prototypes
void output_numbers1(int *, int);
void output_numbers2(int *, int);
void output_numbers3(int *, int);
@rajkumar-p
rajkumar-p / 2d_array_pointers.cpp
Created September 30, 2011 18:31
Loop through a 2-d array using pointers
#include <iostream>
using namespace std;
int main() {
int i_2d_arr [3][5] = { {4, 2, 7, 8, 1},
{12, 19, 15, 16, 11},
{23, 28, 22, 29, 28}
};
@rajkumar-p
rajkumar-p / 2d_array_functions.cpp
Created October 1, 2011 06:16
Passing 2-d arrays to functions
#include <iostream>
using namespace std;
int main() {
int i_2d_arr [3][5] = { {4, 2, 7, 8, 1},
{12, 19, 15, 16, 11},
{23, 28, 22, 29, 28}
};