Skip to main content

Posts

Showing posts from November, 2011

Basic Priority queue in C

The source code of basic priority queue is given : #include<stdio.h> #include<malloc.h> void insert(); void del(); void display(); struct node     {         int priority;         int info;         struct node *next;     }*start, *q, *temp, *new; typedef struct node *N; int main() {     int ch;     do      {             printf( "\n[1] INSERTION\t[2] DELETION\t[3] DISPLAY [4] EXIT\t:" );             scanf( "%d", &ch );             switch ( ch )                 {               ...

Hadoop Simple Indexer source code with Map reduce

/*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package lineindexer; /**  *  * @author masteruser  */ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.filecache.DistributedCache; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.FileOutputFormat; import org.apache.hadoop.mapred.FileSplit; import org.apache.hadoop.mapred.JobClient; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reducer; import org.apache.had...

SCTP server client Code in C

Client.c #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <netinet/sctp.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <errno.h> #define RECVBUFSIZE     4096 #define PPID            1234 int main() {        int SctpScocket, in, flags;        socklen_t opt_len;        char * szAddress;        int iPort;        char * szMsg;        int iMsgSize;        char a[1024];            struct sockaddr_in servaddr = {0};        struct sctp_status status = {0};    ...