Skip to content

Instantly share code, notes, and snippets.

Avatar

Anton antgustech

  • Sweden
View GitHub Profile
@antgustech
antgustech / Program.cs
Created Sep 20, 2017
Knapsack Fractorial algorithm translated from Geeksforgeeks
View Program.cs
//http://www.geeksforgeeks.org/fractional-knapsack-problem/
class Program
{
static void Main(string[] args)
{
new Program();
}
public Program()
{
View Buffer.java
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 Jan 5, 2017
Radix sort java implementation
View Radix.java
package main;
import java.util.LinkedList;
import java.util.Queue;
/**
* Implementation of radix sort.
*
* @author Anton Gustafsson
*
@antgustech
antgustech / HuffmanTree.java
Created Dec 30, 2016
HuffmanTree Java implementation.
View HuffmanTree.java
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 Dec 9, 2016
Eating philosofer example
View Philosofer.java
package main;
import java.util.concurrent.Semaphore;
/**
* Thread representing a philosofer.
*
* @author Anton Gustafsson
*
*/
View gist:9006594c4890153c11b2381c1b183e47
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;
View gist:efe86163e2a51b4e9dc2c9efdd4430ab
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.";
}