Skip to content

Instantly share code, notes, and snippets.

View apremalal's full-sized avatar

Anuruddha apremalal

View GitHub Profile
public void test()
{
System.out.println("test");
}
@apremalal
apremalal / pom.xml
Last active December 12, 2015 08:59
Paste this code under the plugins section of the pom file.
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
</plugin>
@apremalal
apremalal / pom.xml
Last active December 12, 2015 10:39
GATE dependencies to add in to pom file.
<!-- GATES -->
<dependency>
<groupId>uk.ac.gate</groupId>
<artifactId>gate-core</artifactId>
<version>7.0</version>
</dependency>
<!--Apache commons pool-->
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
@apremalal
apremalal / BinarySearchTree.java
Last active December 13, 2015 21:08
This is an implementation of the binary search tree. Reference - Introduction to Algorithms
public class BinarySearchTree {
void in_order_tree_walk(Node x) {
in_order_tree_walk(x.left);
System.out.println(x.key);
in_order_tree_walk(x.right);
}
void insert(Node T, Node x) {
Node y = T;
while (y != null) {
@apremalal
apremalal / SingleLinkedList.java
Last active December 13, 2015 21:08
An implementation of single Linked List in java.
import java.util.Arrays;
public class SingleLinkedList {
Node head;
int i = 0;
void insert(SingleLinkedList li, Node x) {
x.next = li.head;
li.head = x;
@apremalal
apremalal / LinkedList.java
Created February 18, 2013 06:01
An implementation of doubly linked list in java.
public class LinkedList {
Node head;
void insert(LinkedList li, Node x) {
x.next = li.head;
if (li.head != null) {
li.head.pre = x;
}
li.head = x;
@apremalal
apremalal / Stack.java
Created February 18, 2013 06:02
An implementation of a Stack in java
public class Stack {
int s[] = new int[100];
int top = -1;
boolean isEmpty(Stack s) {
if (s.top < 0) {
return true;
} else
return false;
}
@apremalal
apremalal / BubbleSort.java
Created February 18, 2013 06:15
Bubble sort algorithm implementation in java
public class BubbleSort {
public static void main(String args[]) {
int a[] = { 2, 3, 6, 1, 9, 2, 10, 5 };
int sorted[] = buble(a);
for (int x : sorted) {
System.out.print(x + " ");
}
}
public static int[] buble(int a[]) {
@apremalal
apremalal / InsertionSort.java
Created February 18, 2013 06:16
Insertion sort implementation in java.
public class InsertionSort {
public static void main(String a[]) {
int data[] = { 9, 2, 6, 1, 8, 10, 1, 0 };
int sortedarr[] = insertionSort(data);
for (int x : sortedarr) {
System.out.print(x + " ");
}
}
public static int[] insertionSort(int array[]) {
@apremalal
apremalal / QuiclkSort.java
Created February 18, 2013 06:18
Quick sort implementation for integers in java.
import java.util.*;
public class QuickSort
{
int a[];
QuickSort(int a[])
{
this.a=a;
}
int[] sort()