Skip to content

Instantly share code, notes, and snippets.

View rajivseelam's full-sized avatar

Rajiv Seelam rajivseelam

View GitHub Profile
@rajivseelam
rajivseelam / bstwithlot.c
Created September 7, 2012 09:20
Binary Search Tree with Level Order Traversal
#include<stdio.h>
#include<stdlib.h>
/*********************** TREE ************************/
typedef struct _tnode{
int value;
struct _tnode *left;
struct _tnode *right;
} tnode;
@rajivseelam
rajivseelam / pre_succ_from_node.c
Created September 7, 2012 11:16
Find Predecessor & Successor of a node using two methods (One going up from node, other coming down from root)
#include<stdio.h>
#include<stdlib.h>
/*********
In this program we store the parent of the node too.
We go from node to find the corresponding parent.
***************/
/*********************** TREE ************************/
typedef struct _tnode{
@rajivseelam
rajivseelam / avltree.c
Created September 10, 2012 09:51
AVL Tree
#include<stdio.h>
#include<stdlib.h>
/*********************** TREE ************************/
typedef struct _tnode{
int value;
struct _tnode *left;
struct _tnode *right;
} tnode;
@rajivseelam
rajivseelam / max_heap.c
Created September 17, 2012 12:11
Heaps implement Priority Queues
#include<stdio.h>
#include<stdlib.h>
#define MaxData (32767)
typedef struct _bheap{
int Capacity;
int Size;
int *Elements;
@rajivseelam
rajivseelam / revlinkedlist.c
Created September 18, 2012 12:08
Reverse a Linked List
#include<stdio.h>
#include<stdlib.h>
typedef struct _node{
int value;
struct _node * next;
} node;
typedef node linkedlist;
@rajivseelam
rajivseelam / inplacerevstack.c
Created September 19, 2012 03:25
Reverse a stack (inplace)
/***
This program is similar to reversing a linked list. I have done anyway for the heck of it!
****/
#include<stdio.h>
#include<stdlib.h>
typedef struct _node {
int value;
struct _node * next;
@rajivseelam
rajivseelam / README.md
Created October 3, 2012 07:26 — forked from aronwoost/README.md
How to install LAMP on a EC2 Amazon AMI

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

#include<stdio.h>
int main(){
int numberOfProblems, problemThatCanBeSolved = 0, countOfPeople;
char line[1024];
char * str;
scanf("%d",&numberOfProblems);
@rajivseelam
rajivseelam / PermutationsOfString.c
Created October 16, 2012 08:41
Permutations of a String
#include<stdio.h>
void swap(char **s, int low, int high){
char temp;
temp = (*s)[low];
(*s)[low] = (*s)[high];
(*s)[high] = temp;
// printf("%s\n",*s);
@rajivseelam
rajivseelam / circularlyLinkedList.c
Created December 10, 2012 07:06
Linked Lists (Single, Doubly, Circularly, Self Adjusting)
#include<stdio.h>
#include<stdlib.h>
typedef struct _node{
int data;
struct _node *next;
} node;
typedef node circularlyLinkedList;