instruction stringlengths 71 95.1k |
|---|
Introduction
This is yet another data structure I'm going over again for the algorithms course. This time it is binary search tree.
Implemented operations:
Insert
Exists
Remove
Clear
Move constructor and assignment, destructor
There are some tests for remove function below the data structure itself. I tested other fu... |
The task is to return array with values which satisfy the condition: for each max the less or equal numbers count.
Example Input: numbers = [1, 2, 1, 4] maxes = [2, 4]. Output: [3, 4]
Explanation => 1, 2 and 1 are 3 numbers less than or equal to 2, and all 4 numbers satisfy the condition for 4.
Here is my naive appro... |
Please suggest how I can improve my code (like memory leakage, which pattern to use etc.). I have to parse a book XML in two ways: first from an FTP file and second from the REST API. I implemented the methods in one class.
public void GetBooksFromApi(int bookId, int bookNumber = 0)
{
string ApiBookIDPrefix... |
I wrote a program to scan files, extract text, build a data set and export it to a CSV. My initial program was ugly, but it worked. I have since refactored it, but the latest version seems to run a lot slower than its previous rendition.
A brief rundown of the program:
GetFiles()
The program gets a folder to scan
It ... |
I am solving interview question from here.
Problem : Given an array, find the nearest smaller element G[i] for every element A[i] in the array such that the element has an index smaller than i.
More formally, G[i] for an element A[i] = an element A[j] such that
j is maximum possible and j < i and A[j] < A[i].
... |
I am doing one kata on codewars:
Consider a sequence u where u is defined as follows:
The number u(0) = 1 is the first one in u. For each x in u, then y = 2
* x + 1 and z = 3 * x + 1 must be in u too. There are no other numbers in u. Ex: u = [1, 3, 4, 7, 9, 10, 13, 15, 19, 21, 22, 27, ...]
1 gives 3 and 4, then 3 gi... |
I'm looking for the best solution.
Here is a response from server and i need to get Organizations list:
Content-Type:application/json;charset=UTF-8
{
"code": 0,
"message": "success",
"organizations": [
{
"organization_id": "10234695",
"name": "Zillum",
"contact_name": "John Smith",
... |
This is a program that would allow the users to evaluate themselves on a swimming training, it saves the evaluation in a new text file with the date as a title. There are many repeated blocks of code how can I make them smaller?
# We want to get the user input for the warm-up and the main-set.
# We want the user to eva... |
description
write a api client that fetch items from remote service
I have separated Service{} class's helper methods into another class
serviceHelper{} and made it injectable to Service{} class.
With this approach I think I get these benefits
I can mocking serviceHelper{} class
When I mock the serviceHelper{} clas... |
While setting up my Jenkins instance with Ansible to connect to our local GitHub Enterprise instance, I need to recreate what the Github Branch Plugin does to scan an Organizations projects and pre-create the directory structure for all valid projects. I have a solution using multiple levels of include_tasks which is ... |
You are given an array of characters arr that consists of sequences of characters separated by space characters. Each space-delimited sequence of characters defines a word.
Implement a function reverseWords that reverses the order of the words in the array in the most efficient manner.
Explain your solution and analyze... |
I want to easily measure method's execution time. Of course instead of doing something like this:
var timer = Stopwatch.StartNew();
DoSomething();
timer.Stop();
Console.WriteLine(timer.ElapsedMilliseconds)
I want to make it more elegant. What I've managed is something like this:
static class MethodMeasurer
{
publi... |
I am practicing opearator overloading and to write copy constructor. I have written this program of scheduling algoritrhm. Please suggest me some improvements.
#include <iostream>
#include <vector>
class Scheduling
{
int process;
std::vector<int> burst_time;
std::vector<int> waiting_time;
public:
Sc... |
I implemented the Sobel algorithm sequentially, and got decent performance (1.49 s) but wanted to improve it. I parallelized it with OpenMP and got a ~3x speedup (0.523 s). I'd like to do better, but I'm not sure how.
// ------- C/C++ includes ------
#include <iostream>
#include <stdio.h>
#include <omp.h>
#include <t... |
EDIT: the code has been changed significantly since the OP based on the first posted answer and some refactoring. Feedback on the general design of the app itself is still more than welcome. The latest version is here.
I have written a trading bot to interact with Binance in order to turn a crypto portfolio into essent... |
I implemented a method, to create an object based on a series of strings that are passed to it, of any depth or length. The way I implemented the solution was to map over the arguments. Assuming that strings are passed in the form x.a, it then splits the string by the '.', returning just a single object with that key i... |
I am trying to solve some exercises from the "Programming Erlang" book.
One of them is "Write a function to determine which module exports the most functions"
This is my solution:
-module(module_info).
-export([modules_ordered_by_amount_of_functions/0]).
modules_ordered_by_amount_of_functions() ->
Modules = loade... |
I created a script for path search across network topology based on uploaded routing tables in text format. The final purpose is to be able to get all available paths to given subnet/host from each uploaded device with corresponding routing info.
Routing tables are stored in subdirectory (./routing_tables by default) i... |
I've created a script in python which is able to parse proxies (supposed to support "https") from a website. Then the script will use those proxies randomly to parse the title of different coffe shops from a website. With every new request, the script is supposed to use new proxies. I've tried my best to make it flawle... |
I'm in the development phase of a Test class to test send notifications :
1- SMS (send SMS using phone number )
2- Email (send email )
3- WebSocket (send websocket )
This is the first time I have used Junit. It's working but I need a check of the quality of code. My project is a spring boot application rest API.
the b... |
Project Euler Problem #12:
The sequence of triangle numbers is generated by adding the natural
numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7
= 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
Let us list the factors of the first seven triangle numbers:
1: 1
3:... |
I have a class that loads locales from a database. I'm not sure if locale is the right word. It's basically loading texts for a game, generic sayings like alerts and error messages.
I'm also not sure if it should be called WhateverHandler or WhateverController, maybe even WhateverManager. I tend to get really OCD about... |
Context
The Visual Basic Editor (VBE) does a good job at completing member scopes, for example when you type this and hit ENTER...
Private Sub DoSomething
You get this for free:
Private Sub DoSomething()
End Sub
The problem is that VBA is a very, uhm, blocky language, and the VBE doesn't automatically complete any o... |
I am an aspiring C++ programmer and I have been programming for a few years off and on but I don't have much usable knowledge. Right now I am working on filesystem safety so I decided to write an erasure (think BleachBit).
It needs to be run from terminal as such (root/ program filename.something) and needs to open the... |
This is the json
[
{
"SUBTASK": {
"id": 10,
"name": "TestMap",
"description": "",
"version":"1.0"
}
},
{
"SUBTASK": {
"id": 23,
"name": "TestMap",
"description": "",
"version":"2.0"
}
},
{
"SUBTASK": {
"id": 12,
"name": "Tree",
... |
In my project i should cache some items (1 - 1000) in one time.
Item should be removed from cache after 5 minutes by last access to cached item.
Better use community libs, or standart mechanisms (MemoryCache), but i want implement my self stupid cache. I want to hear different criticisms and tips. Thanks!
Code for rev... |
Preliminaries
I have optical sensor ADNS2610 (see datasheet here). There are a few problems which it can be used to solve, but for now let us focus on getting an image from that sensor. This sensor is kind of a small camera which has 400 cpi (counts per inch) resolution. And the resulting image consists of 324 = 18 x 1... |
My problem is following: I want to Find Square root of a number (which is the square of integer) only with addition or subtraction (or together). I wrote the algorithm which works, but I am really interested in what will be better solution to solve this problem.
static void FindSquareRoot(int S)
{
int i = 1;
f... |
My problem is the following: I have to find such x and y (x+y=N) where x * y is the maximum possible value.
I have written an algorithm (which I think works well) and I am looking for more efficient and faster way to solve this problem.
This is my algorithm:
static void Find(int N)
{
int multiplication = 1;
int... |
I am trying to compare two lists containing reference types (custom classes) element-wise, ignoring order. My question relates to the Equals method as shown below.
using System.Collections.Generic;
using System.Linq;
namespace Luxaudi.ViewModels
{
/// <summary>
/// Contains information from the Canvas class th... |
I am a mathematician attempting to become proficient with C++. At the moment I am learning about data structures. I am trying to write a double linked list now from scratch with some help from online tutorials. I wanted to see if there is anything that I could improve. I have made similar posts with other data structur... |
I have done bubble sort algorithm on a vector that is filled with randomly generated values. Bubble sort is actually done with the odd-even transposition method:
#include <iostream>
#include <algorithm>
#include <vector>
#include <random>
#include <thread>
#include <mutex>
void fill_with_random(std::vector<int> &vec)... |
I want to ask for code review for my JavaScript implementation of Flatten_dictionary about this coding challenge for "Flatten a Dictionary" can be found at pramp:
Given a dictionary dict, write a function flattenDictionary that
returns a flattened version of it .
If you’re using a compiled language such Java, C++, C... |
Employee hierarchy in an Organization is classic example of modeling Composite design pattern. Following are the details that are to be modeled:
There are two type of employees; Manager, and Developer.
A Manager manages a team that can comprise managers, and developer.
A Developer has fixed salary at given point of t... |
This is a simple rock-paper-scissors program implemented using C++. Any feedback or suggestions for improvement are welcome.
Code:
main.cpp:
#include <iostream>
#include <string>
#include "rock-paper-scissorss.h"
using namespace std;
void whoWon(string player_move, string computer_move){
if(player_move == "rock")... |
This actually started off as member type for the binary_search_tree, but after realizing that it doesn't compare to values or use the value objects inside of it, I decided to make it standalone. In fact, directly copy pasting it and playing with the template parameters made it work out of the box.
I got surprised by th... |
Not long ago I designed a pure-CSS slide viewer. A demo is available here, while the source code can be retrieved here .
I would like to receive opinions, suggestions, and critiques, especially about my choice of designing the CSS selectors focusing on the semantic aspects of HTML5.
Below the main CSS:
/*\
|*|
|*| ... |
So, this is my problem to solve:
I want to calculate \$2^n\$ where \$0 < n< 10000\$
I am representing each element of array as a space where 4digit number should be "living" and if extra digit appears, I am replacing it to the next element of this array.
The principle I am using looks like this:
The code I am using is... |
Is there a way to simplify this code?
// array
const movieLists = [
{
name: "New Releases",
videos: [
{
"id": 70111470,
"title": "Die Hard",
"boxarts": [
{ width: 150, height: 200, url... |
I'd like to retain as much float precision as possible without having to resort to specialized libraries so I need this code to work with only standard modules.
I'm doing this in QGIS where specialized libraries aren't available by default. numpy would be OK to use.
Sources for the computations can be found on Wikip... |
I made a single header object pool for use in personal projects. It's supposed to be easy to use, cross-platform and thread safe. It uses a free list for allocations and a hashmap for dereferencing handles. I'm self taught so I'm unsure if I'm performing any cardinal sins.
While coding it I focused on keeping my code s... |
I have created line charts in d3.js which show the trend of two measures. Each chart consists of two linecharts and the graph is repeated as many times as there are countries.
So my dataset is this:
var data = [{type:'APPLE', country:'Germany', year:'2000', firstVal:'99.5', secondVal:'4'},
{type:'APPLE', co... |
Context:
I have a program which stores data to the disk. The data is then reprocessed during some of the iterations. Thus, it needs to store, search and load set of data.
Let's consider the following class Signal which defines a multiphasic signal:
class Signal:
def __init__(self, amp, fq, phases):
self.amp... |
Let's consider the following class Signal which defines a multiphasic signal:
class Signal:
def __init__(self, fq, phases):
self.fq = fq
self.phases = phases
I created a function that generates Signal to test in another function.
# -*- coding: utf-8 -*-
import itertools
def duo_SBs_to_test(SB1, S... |
I would like to ask about the code below:
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct AngleDeg
{
public readonly double Degrees; // immutable struct
public AngleDeg(double degrees = 0)
{
Degrees = degrees;
}
public overr... |
I have written a short C/C++ code finding root by bisection. (This is a simple iterative numerical method allowing to find the root of an equation i.e. x such that f(x) = 0). Bisection Method
The header simply consists of guards and of the following lines:
#include <functional>
double bisection(double x1,
... |
I have written TCP server client code to send data of any size (1 byte - 64KB) in a loop.
The client (A) sends data to the server (B). B then sends the same data back to A. A matches the sent data to the data received. If the data does not match, control flow will break from the while-loop. If the data matches, the loo... |
Important
Prebuilt Python Extensions built for Python 3.6
Includes Python f-strings (3.6+)
Complementary GitHub link
https://github.com/thejhonnyguy/CPyMCTS
Notable: Previous attempt with stock Python
Stock Monte Carlo Tree Search implementation to a simple connect 5 game in Python (Includes bugs)
C++ is the star of th... |
First time poster, be gentle.
I wanted something similar to Mojo::Promise->all, except with an option to discard certain rejected (or, I guess, resolved) promises dependent on rejection value, as determined by caller.
Only using this internally, so nevermind my polluting the Mojo::Promise:: namespace.
package Mojo::... |
My aim is to use a thread pool together with a thread local. I cannot use InheritableThreadLocal because the thread data is different per user and there a couple of parallel users at any time.
So I need to push the thread local down from the mother thread to the children.
I use guava so I want to get listenable futur... |
I am solving interview questions from here.
Problem :Given a singly linked list, determine if its a palindrome. Return 1 or 0 denoting if its a palindrome or not, respectively.
Notes:Expected solution is linear in time and constant in space.
For example,
List 1-->2-->1 is a palindrome.
List 1-->2-->3 is not a palindro... |
The challenge
The captcha requires you to review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list.
For example:
1122 produces a sum of 3 (1 + 2) because the first digit ... |
I'm trying to brush up on some C basics (it's been ten years since I've programmed in C) and am working on a simple Rot13 program as a Unix filter. Any suggestions on how to improve it would be appreciated. Specifically, I'm curious if the call to fclose at the end of main is necessary or will have bad potential effect... |
I'm asking for anyone to review my code and provide comments here. The code has a header file but I'll show the c module here. I haven't written any C code since probably before the year 2000. I'm a Java guy. This code will be used on a Linux server by Php code on a web server (Apache). Tell me what you think. Give m... |
I am in the middle of working on this game and I still need to add some things (e.g. score, coin counters, etc.) but I really feel like there is way too much unneeded code. Could you help me simplify this so I can keep adding things?
<!DOCTYPE html>
<html>
<head>
<title>Game</title>
<style>
html, body {
background: l... |
This is a program I made for practice in file handling in C++. The purpose of the program is to write three nos 1 2 and 3 into a file abc.dat and then read it and display it on the monitor. When I check the output I get 123123 instead of just 123. I don't understand why this occurs. When I uncomment the line //if(input... |
During one of assignment, I need to directory and store into proper data structure. I did following way and create to store as tree with multiple child and child will have linked list. Any improvement or suggestion.
File format:
/path1/path2/path3
/path1/path2/path3/cell_lists
/path1/path2/path3/path4
... |
I want to check for a condition in a guarded wait() loop with a user-specified total timeout, similar to how LinkedBlockingQueue.poll() works.
For example collection can be appended to by different threads, but only when the collection contains a value equating to myItem within timeout, should the loop terminate succes... |
Program is written in .Net Framework 4.
Class:
public class yearsComparison
{
public int year { get; set; }
public string material1 { get; set; }
public string material2 { get; set; }
public string material3 { get; set; }
public string material4 { get; set; }
public string material5 { get; set; ... |
I have a prime function which accepts a list of numbers and checks if all of the numbers in the list are prime.
Here is my code:
from math import sqrt
def primes(lista):
return all(True if n == 2 else bool(all(n % x for x in list(range(3, int(sqrt(n)+1), 2))+ [2])) for n in lista)
Can I make this code more readabl... |
I need to be able to detect if an image has the colour Violet in it. (Follow-up)
The problem that I'm facing is that there are quite a number of shades of violet that it seems almost impossible it add every single one.
private void ProcessImage(PictureBox picture)
{
using (System.IO.MemoryStream ms = new S... |
Requirements:
I have to design a database to store tick data of 350 stocks. Inside this database queries will be executed to transform tick data and retrieve OHLC candles of 1 minute, 1 hour, 1 day.
There are on average 15 tick rows inserted each second for every stock and each table is initially populated with an aver... |
The goal is to split a URL like http://q.com/a/b/c to:
['http://q.com/a', 'http://q.com/a/b', 'http://q.com/a/b/c']
My code:
import urlparse
def get_domain_with_protocol(url):
url_parts = urlparse.urlparse(url)
return "{scheme}://{netloc}/".format(
scheme=url_parts.scheme,
netloc=url_parts.... |
I have an array I which stores N images of size P (number of pixels). Every image is of size P = q*q.
Now I want to delete patches of size ps around a selected index IDX (set all values to zero).
My approach was to reshape every single image using reshape(q,q) and delete the pixels around IDX. I also have to check if t... |
I created this class to load in an image and get some specific values I needed.
from PIL import Image
import pandas as pd
class Img:
def __init__(self,filename):
self.name = filename
self.image = Image.open(self.name) # open image using PIL
# convert the image to a pandas df
self.... |
There is an interface:
interface JournalCreator {
@Async
Journal create(Parameters params);
}
And many different implementations:
class CarsJournal implements JournalCreator {
@Autowired
private JournalRepo journalRepo;
@Override
public Journal create(Parameters params) {
String name... |
So I was just reading my algebra-precalculus textbook, and learned that matrices can be used to solve systems of equations. Since the whole process seemed so algorithmic, I wondered if I could implement it as a program. The result is the following:
/*
*
* Solve a system of equations in two variables, x and y
*
*/
... |
I have two models in Flask-SQLAlchemy (Post and Comment) that have many-to-many relationship that is manifested in the third model (post_mentions):
post_mentions = db.Table(
'post_mentions',
db.Column('post_id', db.Integer, db.ForeignKey('posts.id'), primary_key=True),
db.Column('comment_id', db.Integer, db... |
This is a class/template I just wrote for my embedded project (IAR EW ARM - Cortex/ARM7TDMI - Atmel SAM7, SAM4, SAMG). I am gathering data from CAN BUS (FMS), e.g. Engine Revolutions (Per Minute), and wanted to replace current fields with some class that won't break existing code (that is assigning value to it somewhe... |
The code written in Python 3.6 mostly using Python's built in functions sorted and len. First I'm checking for the edge case that the two given strings are not of the same length obviously. Then I'm sorting the strings and comparing if their sorted value are equal to each other with a boolean expression. An anagram is ... |
So I have written a Makefile that has a release function that can be run like: make release bump=patch and I want it to be fully executable in the Makefile. The only issue with my current implementation is that there is a lot of redundancy and long lines of commands, which I think can be simplified a lot, although I ha... |
In my freetime, I did this little Telegram bot in Node.js that provides some basic text-based commands and one command where a user can search for an image in order for the bot to send back an image related to that word.
Is there anything about this code I can optimize regarding performance and / or code quality in gen... |
I wrote this to parse through an Excel doc, extract desired columns, parse certain cells and output another formatted Excel doc.
This is the original Excel doc I have condensed most of the columns for space
Here are the the results of the program that I am mostly happy with, it parses the name column and writes a unit... |
I've been working on the functions that handle when a player's sprite interacts with either a wall (0) or say the crate to push (£)
I'm just wondering how this looks and if there alternative methods, as I've been told I can make things more complicated than they really need to be.
def MOVE_UP():
x = MapGrid.getChar... |
I wanted to write a template matching algorithm from scratch.
The key area's I'm interesting in are readability, maintainability, DRY, and if the program performance/efficiency could be improved in any way.
Image scanning class:
import sys
from itertools import izip
class ScanImage:
def __init__(self, image, templa... |
After having to swap the feature rich System.Text.StringBuilder for the very fast but very vanilla A lightning-fast StringBuilder, I decided it was time create a StringBuilder class of my own.
The concept is quite simple: As text is appended to the encapsulating class it is added to an Array. Whenever a method is ca... |
I am writing a simple java class for date calculations, I am aware there are probably better ones out there, but I want to do this myself for practicing purposes. I am planning on expanding this class but I am posting this here mainly because this is the first time I am doing something OOP related and the first time I ... |
This class, UnorderedList, implements an Unordered list in Java. In this class, duplicates are allowed. remove(argument) will delete the first occurrence of the argument. I was wondering to add other functions named add(int index, int data) and set(int index, int data) or not. Since the class is unordered, I thought I ... |
I'm teaching myself a little C, and I've found this website. It has an exercise about manipulating a BMP file in C. I would like to know if I can make my code look more "idiomatic" or professional, from the format of the comments to the name of the variables.
I also have some other questions:
This is the standard way ... |
This code is a Frankenstein. I found ten examples done in ten different ways and my requirements were slightly different so even if they were reliable they weren't a copy and paste solution.
Encrypt takes in a byte[] and password and returns the byte[] encrypted with the password. It has to tack on the length of the or... |
I would like some input on the Makefile I'm using for my C++ project. It is my first Makefile and I learned how to do what I want through various readings on the web. The directory structure is as follows :
project directory
|___ src/ (source files)
|___ include/ (header files)
|___ tests/ (source files each containin... |
I'm trying to write a program to detect the colour violet in an image.As discussed in my previous Post @Johnbot suggested that I try using HSL / HSV to determine if the pixel is some shade of violet.
this.button2.Click += async (sender, e) =>
{
Task task = Task.Run(() =>
{
ProcessImage(pictureBox1.Image);... |
Would like to check if anyone here is able to simplify the following code.
What it does: Extract data labels value from a chart in powerpoint to excel.
Sub Extract_Datalabels3()
'Goal: To extract datalabels of Chart's series collection and write to excel
'Working
Dim sh As Shape
Dim sld As slide
Dim chtnow... |
I'm building some modules in VHDL for handling modular arithmetic and want to make sure it's well-designed for timing and somewhat efficient when scaling up. This will need to work with 128-bit or 256-bit arithmetic when complete, but I'm testing it currently with small 16-bit numbers currently. There are two modules, ... |
I have written a program to optimize a point cloud in dependency of their distances to each other. The code works very well for smaller number of points. For 1700 points it takes ca. 6 minutes. But I have 300000 points in the point cloud. The code is still running after almost 30 hours.
I am sure there is a pythonic w... |
The next thing I will work on is parentheses. Do you think it would be smarter to split the input into 2 lists, one for operators and one for numbers?
Also, is there anything I can/should improve?
public class T11 {
static boolean repeatTry = true;
private static Scanner sInput;
static boolean quit2;
s... |
I am developing a FSM to segment Thai syllables with the following rules:
Here are my util functions:
package edu.washington.rippeth.ling473
package object proj3 {
private[proj3] def optionallyAppend(sb: StringBuilder, char: Option[Char]): StringBuilder = char match {
case Some(c) =>
sb.append(c)
s... |
I have a program that uses ArrayLists to store a pyramid that has been read by a txt file and calculates the minimum sum value of travelling from the top of the pyramid to the bottom.
My code's main method is like this:
File file1 = new File(args[0]);
Scanner reader = new Scanner(file1); // The Scanner that is going to... |
This code basically check whether a person is in the grid of another person.
The algorithm should check all possible 2-permutations of persons whether a person is in another person grid. In the first version. It was two for loops. The outer one iterates all persons while the inner one iterates all persons for the selec... |
The problem that this is based on is something like the following:
A matchmaker is working with six clients: John, Joe, Charlie, Jill, Leslie, and Katie. John is compatible with Jill and Leslie, Joe is compatible with Jill. Charlie is compatible with Jill, Leslie, and Katie. How should the matchmaker match them to hav... |
I find this script handy for preparing ad-hoc reporting. Using two sets of unique identifiers, it allows you to lookup multiple columns of data with the Index Match function. I welcome any feedback or suggestions for improvement.
Sub MatchMaster_PRO()
'Peter Domanico (June 2018)
'this script helps simplify the use of ... |
The main entry point is the SyncmyCompany() function.
I have a interesting scenario where I'm syncing data from a Company to a destination system. In this case Dynamics 365 is the destination system. The main flow of the code is:
Get the configuration defined in Dynamics 365 and store data in my configuration object.
... |
My concerns:
Is the code pythonic?
Does the receive_all function make the code any cleaner or should that functionally be apart of the get function?
import socket
import urlparse
CONNECTION_TIMEOUT = 0.30
CHUNK_SIZE = 1024
socket.setdefaulttimeout = CONNECTION_TIMEOUT
CRLF = "\r\n\r\n"
def receive_all(sock, chunk_siz... |
This program is used to find the nodes in a grid network, between which, if an edge is added, the average shortest path length of the entire grid reduces by the most.
"Average shortest path length" is the statistic computed by the NetworkX function average_shortest_path_length, that is, $$ \sum_{s,t∈V} {d(s, t) \over n... |
I stumbled across this post on SO, and it had a link to some good code; however the code itself was a bit dated. Since the code has a "do not modify" clause I went back to the basics as noted by the urls in the comments and rebuilt it from the ground up using more or less the same style, except making it 64-bit friendl... |
This provides text file conversion capabilities like the common Unix utilities "ux2dos" and "dos2ux".
I needed the capability to perform Unix text file conversions, round trip, within a VB.NET project without being dependant upon external binaries. I couldn't find anything like that on NuGet so I wrote my own.
I'm fair... |
I've implemented a very simple resizable integer array in C, only including functionality to add and remove elements at various indexes.
I haven't looked at using void pointers to handle any type of data yet. I'm mainly wondering if my structure of the code is okay, with the header file containing external API details ... |
I've written a JavaScript prototype which extends the video tag with a new function.
myVideo.subtitle('/path/to/subtitle')
The HTML video tag only supports WebVTT as subtitles. So I thought, let's create support for .srt files as well with a custom written script.
It doesn't add support throughout the <track> element,... |
We're converting the City of Philadelphia's website to be served as static files. In order to support redirects and rewrites (URL masking), we decided to use a Lambda@edge function, which modifies (or responds to) the inbound request. I expect this will be maintained by other people so readability is very important. I ... |
This is a basic game loop written in C++ using SDL. All feedback is appreciated especially feedback related to design and extensibility.
Main.cpp:
#include "Game.h"
int main(int argc, char* argv[])
{
Game game;
game.Start();
return 0;
}
Game.h:
#pragma once
#include <SDL.h>
class Game
{
private:
SD... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.