Skip to content

Instantly share code, notes, and snippets.

package problems;
import java.util.Arrays;
public class BoyerMoore {
/**
* Bad Character Rule
* <p/>
* Preprocess the pattern string. Returns array with
* array[c] = position of rightmost occurrence of c in the pattern
@lucaslouca
lucaslouca / LLUGrid.swift
Last active February 14, 2016 13:16
Swift class representing a grid, where elements can be accessed using [x,y] subscript syntax
//
// LLUGrid.swift
//
// Class representing a grid, where elements can be accessed using [x,y] subscript syntax
// Example:
// var grid = Grid<Bool>(rows: 3, columns: 10, defaultValue: false)
// grid[1,2] = true
//
// Created by Lucas Louca on 06/02/16.
// Copyright © 2016 Lucas Louca. All rights reserved.
@lucaslouca
lucaslouca / TTCSV2HashMap.java
Last active February 8, 2016 10:03
Convert a CSV file to List<Map<String, String>>
package com.tool.main;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
@lucaslouca
lucaslouca / TTSheet2HashMap.java
Last active December 5, 2025 08:54
Convert a XLSX file to List<Map<String, String>>
package com.tool.main;
import java.util.List;
import java.util.Map;
public interface TTSheet2HashMap {
/****************************************** PUBLIC ********************************************/
/**
* Initiates the processing of the sheet to List<Map<String,
@lucaslouca
lucaslouca / SuffixTree.java
Last active March 1, 2016 08:35
Basic SuffixTree Implementation
package problems;
import java.util.HashMap;
import java.util.Map;
/**
* Created by lucas on 29/02/16.
*/
public class SuffixTree {
package problems;
public class TrieTest {
static class TrieNode {
private final int SIZE = 4;
TrieNode[] children;
char c;
package problems;
import java.util.LinkedList;
import java.util.Queue;
public class AhoCorasick {
static class TrieNode {
private final int SIZE = 4;
use DBI;
use strict;
my $usersFile = sprintf("users.txt");
open(STDOUT, ">>", $usersFile);
my $driver = "Oracle";
my $sid = "SID01";
my $userid = "admin";
my $password = "s3cret";
package problems;
public class MergeSort {
private static void print(int[] a) {
for (int n : a) {
System.out.print(n + " ");
}
System.out.println();
}
package problems;
import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
/**
*
* "In the read() call, we do not do any fancy checks as Java does in the BufferedReader class. Plus we don't acquire any mutex locks which saves us additional cycles."
*