Skip to content

Instantly share code, notes, and snippets.

View antgustech's full-sized avatar

Anton antgustech

  • Sweden
View GitHub Profile
@antgustech
antgustech / Program.cs
Created September 20, 2017 17:37
Knapsack Fractorial algorithm translated from Geeksforgeeks
//http://www.geeksforgeeks.org/fractional-knapsack-problem/
class Program
{
static void Main(string[] args)
{
new Program();
}
public Program()
{
@antgustech
antgustech / Buffer.java
Created January 31, 2017 13:46
Assignment 4
package assignment4;
/**
*
* A buffer class that has a 2 arrays, one for strings and one containing
* statuses. One index for each operation. Methods use monitors by using the
* synchronized keyword.
*
*/
public class Buffer {
@antgustech
antgustech / Radix.java
Created January 5, 2017 15:00
Radix sort java implementation
package main;
import java.util.LinkedList;
import java.util.Queue;
/**
* Implementation of radix sort.
*
* @author Anton Gustafsson
*
@antgustech
antgustech / HuffmanTree.java
Created December 30, 2016 10:11
HuffmanTree Java implementation.
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.stream.Collectors;
/**
*A huffman tree implementation. To test it,
*create a new instance of this class and
*pass in a string to encode.
@antgustech
antgustech / Philosofer.java
Created December 9, 2016 15:39
Eating philosofer example
package main;
import java.util.concurrent.Semaphore;
/**
* Thread representing a philosofer.
*
* @author Anton Gustafsson
*
*/
import com.mysql.jdbc.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
CharSequence emptyInputMsg = null;
String title = inputTitle.getText().toString();
String amount = inputAmount.getText().toString();
String date = inputDate.getText().toString();
if(title.equals("")) {
emptyInputMsg = "Vänta lite, fuck you.";
}