Skip to content

Instantly share code, notes, and snippets.

View JakubMifek's full-sized avatar
💭
I may be slow to respond.

Jakub Mifek JakubMifek

💭
I may be slow to respond.
View GitHub Profile
@JakubMifek
JakubMifek / hashing.c
Created December 27, 2017 21:55
Homework assignment for Data Structures I course at Charles University
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FibonacciHeap
{
public class StreamParser
private const int BufferSize = 4096;
private static readonly char[] Buffer = new char[BufferSize];
static void ReadInput(StreamReader reader)
{
int count, read = 0;
while ((count = reader.ReadBlock(Buffer, read, BufferSize)) > 0)
{
var index = 0;
@JakubMifek
JakubMifek / Cut.cs
Last active November 18, 2017 13:49
private static void Cut(FibTree<T> tree, FibNode node)
{
if (tree == null)
throw new ArgumentNullException(nameof(FibTree<T>));
while (node != null)
{
var parent = node.Parent;
if (parent == null)
return;
function [ Output ] = CrossVal(Name1,Name1L,Par1,Name2,Name2L,Par2,Pat,DOut,k,~)
if nargin < 9
error("Wrong number of parameters. Expected at least 9.");
end
if nargin == 9
% Shuffle the input set
perm = randperm(size(Pat,2));
Pat = Pat(:,perm);
DOut = DOut(perm);
function [ delta, s ] = CrossVal(Name1,Name1L,Par1,Name2,Name2L,Par2,Pat,DOut,k,NoShuffle)
if nargin < 9
error("Wrong number of parameters. Expected at least 9.");
end
if nargin == 9
% Shuffle the input set
perm = randperm(size(Pat,2));
Pat = Pat(:,perm);
DOut = DOut(perm);
package cz.sokoban4j.simulation.board.minimal;
import cz.sokoban4j.simulation.board.compact.BoardCompact;
import cz.sokoban4j.simulation.board.compact.CTile;
import cz.sokoban4j.simulation.board.compressed.StateCompressed;
import cz.sokoban4j.simulation.board.oop.Board;
/**
* Runtime-part of the Sokoban game state (excluding static board configuration, just positions).
* <p>
@JakubMifek
JakubMifek / N&N's
Last active October 25, 2017 16:05
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyProject
{
class Program
import Text.Read
import Control.Monad
import Control.Monad.State
import System.Random
----------------
-- Structures --
----------------
data Symbol = Circle | Cross deriving (Show, Read, Eq, Enum)
#include <stdio.h>
int
main (int argc, char *argv[]) {
const int i = 2;
const int * const pi = &i;
int *xi;
xi = (int *)pi;