This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.geeksforgeeks.org/fractional-knapsack-problem/ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
new Program(); | |
} | |
public Program() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import java.util.LinkedList; | |
import java.util.Queue; | |
/** | |
* Implementation of radix sort. | |
* | |
* @author Anton Gustafsson | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main; | |
import java.util.concurrent.Semaphore; | |
/** | |
* Thread representing a philosofer. | |
* | |
* @author Anton Gustafsson | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."; | |
} |