This file contains hidden or 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
| #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) |
This file contains hidden or 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
| ///////////// | |
| // HashMap // | |
| ///////////// | |
| function HashMapNode(key, value) { | |
| this.key = key; | |
| this.value = value; | |
| this.prev = null; | |
| this.next = null; | |
| } |
This file contains hidden or 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
| from time import time | |
| def SieveofEratosthenes(primeseries): | |
| i=1 | |
| primeserieslist = [] | |
| while(i<primeseries): | |
| i=i+1 | |
| primeserieslist.append(i) |
This file contains hidden or 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 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). |
This file contains hidden or 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 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; |
This file contains hidden or 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
| @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 ( |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| #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> |
This file contains hidden or 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
| #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) { |
This file contains hidden or 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
| 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] |