Rodion Efremov coderodde
- Espoo, Finland
- Sign in to view email
- www.cs.helsinki.fi/u/rodionef
View main.c
#include "singly_linked_list.h" | |
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int i; | |
singly_linked_list_t* list = singly_linked_list_alloc(); | |
singly_linked_list_iterator_t* iterator; | |
for (i = 1; i < 6; ++i) |
View Pathfinders.js
///////////// | |
// HashMap // | |
///////////// | |
function HashMapNode(key, value) { | |
this.key = key; | |
this.value = value; | |
this.prev = null; | |
this.next = null; | |
} |
View cr_sieve_of_eratosthenes.py
from time import time | |
def SieveofEratosthenes(primeseries): | |
i=1 | |
primeserieslist = [] | |
while(i<primeseries): | |
i=i+1 | |
primeserieslist.append(i) |
View InShuffleAlgorithm.java
package net.coderodde.util; | |
import java.util.Arrays; | |
import java.util.Objects; | |
/** | |
* This class implements a linear-time, in-place in-shuffle algorithm. | |
* | |
* @author Rodion "rodde" Efremov | |
* @version 1.6 (Aug 25, 2017). |
View Paddle.java
package square; | |
import java.awt.*; | |
public class Paddle { | |
public static final int RECT_WIDTH = 200; | |
public static final int RECT_HEIGHT = 100; | |
private int x = (Shapes.WIN_WIDTH - RECT_WIDTH) / 2; | |
private int y = (Shapes.WIN_HEIGHT - RECT_HEIGHT) / 2; |
View dt.bat
@echo off | |
del "C:\Users\Rodion Efremov\.dt\cd.bat" | |
if [%1] == [] ( | |
dt_engine.exe > "C:\Users\Rodion Efremov\.dt\cd.bat" | |
) else ( | |
dt_engine.exe %1 > "C:\Users\Rodion Efremov\.dt\cd.bat" | |
) | |
if %ERRORLEVEL% NEQ 0 ( |
View dijkstra.py
G16 = {'a':[('b',3),('c',2)], 'b':[('c',-2)], 'c':[('d',1)], 'd':[]} | |
# the graph is a dictionary with they "key" as nodes and the "value" as a | |
# list of tuples | |
# each of those tuples represent an edge from the key vertex to the first | |
# element of the tuple | |
# the second element of the tuple is the weight of that edge. | |
# so, 'a':[('b',3),('c',2)] means an edge from a to b with weight 3 | |
# and another edge from a to c with weight 2. | |
class minq: #min_queue implementation to pop the vertex with the minimum distance |
View a_star.hpp
#ifndef NET_CODERODDE_PATHFINDING_A_STAR_HPP | |
#define NET_CODERODDE_PATHFINDING_A_STAR_HPP | |
#include "child_node_iterator.hpp" | |
#include "heuristic_function.hpp" | |
#include "path_not_found_exception.hpp" | |
#include "weighted_path.hpp" | |
#include "weight_function.hpp" | |
#include <iostream> | |
#include <queue> |
View main.cpp
#include <iostream> | |
#include <vector> | |
#include <queue> | |
#include <list> | |
#include <unordered_map> | |
typedef std::vector<std::list<int>> AdjacencyList; | |
typedef std::unordered_map<int, std::unordered_map<int, size_t>> Weights; | |
std::pair<std::vector<int>, std::vector<size_t>> dijkstra(AdjacencyList &adj, Weights weights, int src) { |
View insertion_sorts.py
from random import randint | |
from time import time | |
def insertionSort(lst): | |
for i in range(1, len(lst)): | |
if lst[i] < lst[i-1]: | |
for j in range(i): | |
if lst[i] < lst[j]: | |
lst[i], lst[j] = lst[j], lst[i] |