instruction stringlengths 71 95.1k |
|---|
The code bellow is my implementation for the natural merge exercise in Robert Sedgwick's Algorithms book:
Write a version of bottom-up mergesort that takes advantage of order
in the array by proceeding as follows each time it needs to find two
arrays to merge: find a sorted subarray (by incrementing a pointer
unt... |
This program calculates with numbers from different number systems and outputs the result in the desired number system.
You call it like that:
java Calculator <operator> <number> <base> <otherNumber> <base> (solutionBase)
Unfortunately it does not work with floating point numbers.
Example:
$java Calculator + 5234 7 FA... |
Problem: Given a string str and array of pairs that indicates which
indices in the string can be swapped, return the lexicographically
largest string that results from doing the allowed swaps. You can swap
indices any number of times.
Example
For str = "abdc" and pairs = [[1, 4], [3, 4]], the output should be
... |
I have written a probability table generator in Java to help me generate randomized girl's names for the game I am making.
It reads from a text file and creates a HashMap<String, Double> full of two-character combinations and their rate of incidence.
I don't have a lot of experience with either probability tables or Ja... |
I'm creating a django web application and I would like to know how to shorten this code.
I have a model where every user has a typeOfPerson (Student, Teacher, Guest ...) and I want to count these types.
@register.simple_tag()
def get_stats_type(choice):
items = []
for vote in choice.vote_set.all():
if v... |
The idea is to write a function that takes two strings and returns a new string that repeats in the previous two: examples:
'ABBA' & 'AOHB' => 'AB'
'cohs' & 'ohba' => 'oh'
A brute force solution would be nested for loops like so:
const x = 'ABCD'
const y = 'AHOB'
function subStr(str1, str2) {
let final = ''
fo... |
I would like some feedback on a CMakeLists.txt file I created for compiling my project. I have pasted the CMakeLists as well as my source code below. One thing I would specifically appreciate feedback on the sanitization options I have enabled. Are there more I should enable, and/or should I should reduce? I know -fsan... |
I'm new to MVVM and WPF. Please suggest whether this is okay or I need to correct my understanding of MVVM which I confess is very limited as at the moment.
I have created a simple addition application which gets two number as input and provide the added number after clicking the Button.
Please give me your honest (an... |
function solution(A) {
var len = A.length;
if(len > 1){
let max = Math.max.apply(null, A);
let range = Array.from(Array(max).keys());
for(let i = 0; i < range.length; i++){
if(A.includes(range[i]) === false){
if(range[i] > 0){
return range[... |
I am trying to do my c++ homework and as a part of it I have to implement a std::map with an int as its key and a value should be a specific void function, which prints some text.
I can`t find an answer to what are the correct ways of doing that.
This is what I have so far:
#include <map>
#include <string>
#include <io... |
Here is my code with 2 services, one is messageService which is used to get user messages:
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import 'rxjs/add/operator/retry';
import 'rxjs/add/operator/catch';
import... |
How could I rewrite this jquery code to compact it in a more elegant form:
$(document).ready(function(){
$('input[name="table_exist"]').click(function(){
if($('input[name="table_name"]').val()=='users' && $('input[name="table_exist"]').is(':checked'))
{
$('input[name="table_name"]').val('');
}
... |
I've begun developing a library which can be used to represent and analyse corporate ownership structures. The first stage has been to design a library which allows a user to model ownership structures (e.g. company A owns 52% of B and 90% of C).
The library contains two fundamental types - entities (i.e. companies) an... |
I have built an Excel application, which gets all the titles of books from Amazon.com, which it is asked to do and scrapes the following data out of them:
Book Title
Author
Price
What do you need to run the app?
3 worksheets in Excel, named as in the picture:
Then in tblInput, make sure to write some keywords in ra... |
Siruri2 | www.pbinfo.ro
Fibonacci, a famous Italian mathematician in the Mediaeval Era, had discovered
a series of natural numbers with multiple applications, a string that
bears his name:
Fibonacci (n) = 1, if n = 1 or n = 2
Fibonacci (n) = Fibonacci (n−1) + Fibonacci (n−2), if n>2
Fascinated by Fibonacci's li... |
I work on a small data team where we developed this tool when we began experiencing several job failures on our legacy big data systems. We have several data lakes, each with their own API, and until now had no contingencies for issues centering around query failures. Furthermore, our database sockets had no central re... |
What improvements can I make? Should I organize my functions based on A-Z? For example, find_letter function comes before guessing function.
import json
import random
import re
def find_letter(user_input, vocab, i=None):
return [i.start() for i in re.finditer(user_input, vocab)]
def guessing(tries,vocab,blank_... |
Problem:
Given a square or rectangular matrix, print its element in spiral
order.
For example, if input matrix is this:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Output should be:
1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
This code assumes a matrix of 6X5. I do feel it can look more... |
I'm fairly new to C, and this is my first time using pthread. I am pretty sure I implemented it correctly, however I'd like to verify it is indeed executing the tasks parallel instead of sequentially. Here is my main.c code:
main.c
#include "frequency.h"
/**
* The main function. Runs {@code getMedianWord()} in parall... |
Is this reliable, or have I missed something?
I want a drop-in replacement for WaitForSingleObject (sans the return type, I like HRESULT much better than any other error codes).
This code works in a plugin DLL for third party closed-source software. I don’t have source code of that app, i.e. if you ask “what else might... |
I have been working on a function that return a FSM that searches a specific word based on the argument of the constructor. The idea was to use those routines as means to learn about regular expressions and maybe implement a very basic regexp system, so I thought that matching normal string was a good first step in tha... |
This is a continuation from my original question. After the improvements suggested by @Reinderien and some of my own.
This approach I've taken is kinda obvious. And I'm not using any parallel processing. I think there's scope for improvement because I know of a crate, Rayon in Rust which could have run the steps I'm cu... |
0x2048
This is my implementation of the classic game "2048" in C.
The instruction to build/run the project (GitHub repo) can be found here.
I started with the core game and then built a GUI interface out of it.
I would love some feedback on my design. How the same implementation can be better written. Idioms, convent... |
This script is a tool to help minecraft mod development. When you want to add a new block to the game you have to create three json files. This script generates three JSON files in specific locations. It's intended to be run in a certain directory so that the files go into the right location. Also it's for my own perso... |
I recently ported a blog of mine from Python to Go (to improve speed and performance) and while all is great so far, I'd like some help optimising the Markdown function to improve the general performance, maintenance and readability of the function.
I have this function because I write my blog articles in Markdown (.md... |
Bulls and Cows is a simple code-breaking game sometimes better known as "Mastermind." The rules are explained here: https://en.wikipedia.org/wiki/Bulls_and_Cows
I would appreciate some feedback on the following implementation in terms of overall code quality, layout and logic. It's meant to be at a fairly basic level s... |
I'm working my way through the examples in an OpenGL website; I'm now on tutorial 2 ("the first triangle").
Among the (many) things I've changed from the sample include:
Replacing the hodge-podge of C and C++ with pure C
Adding more error handling output
Adding a makefile
Moving all of the pertinent code from their co... |
My aim is to simulate the following model by means of a Monte Carlo simulation. I wonder if my R code is correct for generating the data.
Could somebody check?
The model:
$$Y = \sum_{j=1}^{100} (1+(-1)^{j}A_j X_j + B_j \sin(6X_j)) \sum_{j=1}^{50} (1+X_j/50) + \epsilon$$
where
\$A_1, \dots, A_{100}\$ are i.i.d. \$∼ ... |
I have built a generator that, using the GitHub API, creates a dictionary containing a tree of all the resources in any GitHub repo. It uses the function git_tree, which takes one argument, a repo-string (repo-author/repo-name). For example, this repo only contains one file, a README. If we pass in the repo-string, and... |
I have a Repository class which looks like this:
public class Repository extends Observable {
private List<Event> events;
private List<Article> articles;
private List<Article> sportArticles;
private List<Article> fitnessArticles;
private List<Article> governmentArticles;
private Article mainArt... |
I have a computer that roams, but needs to have an FQDN attached to it for certain reasons such as email system integrations or testing email via a testing SMTP server that requires valid FQDNs and HELOs.
My domain(s) are all on CloudFlare, so I wrote an adapted version of another script I had to wrap around CloudFlare... |
I have created a python program that prints a vertical bar graph made from fields and values inputted by the user. It works by first creating a horizontal bar graph and then going through each layer and determining whether to print a letter, a "|", a "_", or a space. I would appreciate any feedback on the program and t... |
I have a log file which is constantly updated with new lines of data. I need to get new added data in java as soon as it's written. For now my solution is:
public static void readNonStop(String filename, boolean goToEnd, FileReadCallback readCallback) {
if(readCallback == null) {
return;
}
try {
... |
Given a matrix, clockwise rotate elements in it.
Examples:
Input
1 2 3
4 5 6
7 8 9
Output:
4 1 2
7 5 3
8 9 6
Input:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Output:
5 1 2 3
9 10 6 4
13 11 7 8
14 15 16 12
Scala Implem... |
I have created a quiz function in my rails application. Since I want to track responses and make it a server-side application I created a table to record the responses of the questions people answer.
create_table "responses", force: :cascade do |t|
t.bigint "question_id"
t.bigint "answer_id"
t.bigint "user_... |
I have recently finished a course on Python 3 and I really learned a lot, but every time I write a script, it is messy and I often feel like there must be shorter, more efficient ways to write and structure my scripts.
So my question is: How could I rewrite the below script to be shorter and more efficient, and what ad... |
Given an array of integers, update the index with multiplication of previous and next integers,
Input: 2 , 3, 4, 5, 6
Output: 2*3, 2*4, 3*5, 4*6, 5*6
Following is a scala implementation for the same. Kindly review.
import scala.util.Random
object NeighborMultiplication extends App {
val numbers = List.fill(10)(Ra... |
I wrote this simple command line interface tic tac toe game with unbeatable AI with unittests. Looking for any suggestions how to improve it.
Game:
#views.py
class GameView:
@property
def intro(self):
return '\nTic Tac Toe\n'
def newlines(self, amount=1):
return '\n' * amount
@prope... |
I have managed to achieve this action through this:
function togglePasswordVisibility($pw, on, id) {
$pw.attr('type', on ? 'password' : 'text');
$('[data-id=' + id + '] > i').toggleClass('fa-eye-slash fa-eye');
}
// $("#pass-on").after('<div class="input-group-append"><span class="password-button password-butt... |
In an effort to stretch my programming muscles, I'm doing the Advent of Code 2018 in a language new to me: Python. Coming from a C# background, I'm probably making all kinds of mistakes or are unaware of some usefull things in Python. This is my solution to day 3, and I would like to get a review on my code. I'm intere... |
I have a simple quiz game where user can give simple answers to simple questions and program will give a result. Please, guys, make a code review and if it is possible answer to my questions placed at the bottom.
Model classes looks like that:
public class Answer
{
public Answer(int id, int questionId, string conte... |
I'm a beginner in OOP and PHP frameworks. I used slim skeleton to create a project and designed the project in this way.
Project structure is given by the slim skeleton. Object Mappers are added by my self. I want to know whether this is a good practice. What I'm doing wrong here. Is there any better way to do this?
... |
Let's say I have this folder tree:
├──FolderParent
├── FolderA
├── FolderAA_IMG -- should be renamed
├── file_IMG_AA1.txt -- should NOT be renamed
├── file_VID_AA1.txt -- should NOT be renamed
├── file_IMG_A1.txt -- should be renamed
├── file_PA... |
I have put together this small application which displays data from a JSON file known as "Users" in an HTML5 table.
I use Bootstrap 3, Axios and Vue.js 2 for this purpose.
Here is the code:
var app = new Vue({
el: '#app',
data: {
users: [],
loading: true,
errored: false,
url: "... |
I am using below virtual method to read the data from SQL Data Reader like:
public IList<District> GetList()
{
IList<District> _list = new List<District>();
SqlConnection con = new SqlConnection(ConStr);
try
{
string StoreProcedure = ConfigurationManager.AppSettings["SP"].ToString();
S... |
The code creates a very simple/easy RPG game, with 2 classes Jedi and Orc. The data is visualized using turtle. Each class has a method of attack (lightsaber_attack for Jedi), which has an argument that must be either a Jedi or Orc instance. The .health attribute of the attacked one will be reduced by .power of the att... |
Well I have 3 methods that are overloads, but in it's scope has the same scope except one method call.
public static Texture2D DrawAnnulus(this Texture2D texture, Func<int, int, Color?> predicate, AnnulusConfig annulusConfig)
{
InitTexture(ref texture, annulusConfig.offset.x + annulusConfig.radius * 2, ... |
The default .net core dependency injection doesn't support building Func<> for injection automatically, see question. I wrote an extension method to go find all the Func in register types constructors and build the Func automatically, needs to be called at end of registrations.
public static class ServiceCollectionExt... |
The following code implements the Boyer Moore string matching algorithm. The algorithm is used to find a sub-string (called the pattern) in a string (called the text) and return the index of the beginning of the pattern.
Looking for comments on correctness, efficiency, clarity and idiomatic C# usages. It passes all te... |
This is a game for two users who roll 2 dice 5 times. If the total of dice is even the player gains 10 points; if it is odd, they lose 5.
If there is a draw after five rounds then both users will have to roll one die to determine the winner.
Some updates that I have done to this code include adding functions to it so t... |
I need set of random unique Integer numbers for my unit test. I implemented this method, however I'm not sure if this is best way to implement this.
private Set<Integer> getRandomUniqueNumberSet(Integer min, Integer max)
{
Set<Integer> added = new LinkedHashSet<Integer>();
for(int i = min; i <= max; i++)
{... |
I wanted to display a markdown document in WPF sensibly without relying on an HTML rendering system. I wrote a control based on the RichTextBox, and used Microsoft's markdown parser. What do you think?
XAML:
<RichTextBox x:Class="MarkdownViewer.MarkdownBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xa... |
I have a semisimple pure js countdown clock that I am having trouble converting the millisecond time correctly.
Here is a working Plunker (besides the date counter)
It Should only be 38 days instead of 184.
//// Should Countdown till feb, 4th 2019 /////
let cd = new Countdown({
cont: document.querySelector(".contain... |
Inspired by CodeWars
We have a string s
Let's say you start with this: "String"
The first thing you do is reverse it: "gnirtS"
Then you will take the string from the 1st position and reverse it
again: "gStrin"
Then you will take the string from the 2nd position and reverse it
again: "gSnirt"
... |
I have a working solution for this problem that was accepted in LeetCode:
Given an array, rotate the array to the right by k steps, where k is non-negative."
function rotate(nums, k) {
for (let i = 1; i <= k; i += 1) {
const poppedNum = nums.pop();
nums.unshift(poppedNum);
}
return nums;
}
// rotate([... |
This is simple student information system project where you can do following things:
Add Records
List Records
Modify Records
Delete Records
To store data a .txt file is used.
I just want an honest critique of my code so I can improve.
#include<iostream>
#include<vector>
#include<string>
#include<fstream>
using... |
I am writing a gRPC Golang application and am looking for the best way to check if the deadline is exceeded or if the client cancelled the call.
On the server side I created a channel called done. When done is called by either the go-routines the server returns with either the error or the success.
In the code I have t... |
I was just wondering if someone could check my small "random dice game", which I programmed due to a "do it yourself" from my PHP book. I am happy that it is working and finished the DIY, but however, I want to know if the solution is okay or if there is a way better/easier way to do it.
Also please let me know if the ... |
Signals are represented as types. You can connect a member function of some instance to the Observer system. This connected function will be called whenever a signal of a type that is the same type as the function parameter is emitted.
ObserverSystem.hpp:
#include <vector>
class ObserverSystem
{
public:
templ... |
Edit: NOTE I'm a C++ "beginner" still in undergrad trying to teach myself modern C++ (because they don't do that in uni) so I'm sure this is riddled with errors that I am unaware of.
Made a subset of std's smart pointer library (unique, shared, and weak, denoted as unq, shr, and weak) in a very minimal header file. Thi... |
I'm working on a WPF 4.5 desktop application that has several nested collections with the following key aspects:
writes mainly from UI thread, but also from worker threads
writes are relatively seldom, mainly directly after a user interaction
reads from any thread, but esp. one performance critical worker thread with ... |
This function below (used on a timeout due to my page loading time) displays information on my site. I grab this data from my table view that I load into the page. It is launched by clicking a button in the table view, and gives that information from the corresponding row. It is very clunky. As you can see in the code,... |
Someone in this thread said I could ask for a review of my revision:
Ncurses Tic Tac Toe with simplistic AI
I re-wrote it from scratch using the suggestions from the answers. In particular I did the following:
I got rid of Global Variables. For the few global constants I used #defines instead.
I used arrays instead of... |
I'm creating an image class that can be used by other classes to create visualizations of data. The class doesn't need to be complicated as the classes will be editing the images pixel by pixel.
The image class will be used to create RGB images and export them to any of the netbpm image formats (pbm, pgm, ppm). I may e... |
I'm creating a login system and I have been reading a lot about the security measures needed to prevent session hijacking, fixation, and injection attacks, etc. These two Stack Overflow posts were particularly helpful: Link Link 2
Below is my login system so far. Have I sufficiently protected myself against attacks?
... |
I am still fairly new to go, and would appreciate any tips on style, best practices, etc, but am especially interested to know if this non-recursive cartesian product implementation can be made significantly faster (eg, when the number of results in the result set is on the order of 1e9).
I've played around with adding... |
I am trying to make a simple clone of the command line utility grep. I'm working on it just for fun and to practice Go. The thing is, I am trying to make it in a way that if several files are given at the command line, a different goroutine is generated to speed up the process. Even so, standard grep still gets results... |
I am a beginner in the python language. I wrote a BMI calculator and I am wondering if there are any improvements I could make to the code. This is the code below:
print('Enter your weight in kilo:')
weightInKilo = float(input())
print('Enter your height in feet:')
heightInFeet = float(input())
heightInMeter = heigh... |
I do work for a project currently, where the data is send to the server as application/x-www-form-urlencoded (which is bad, and it should be JSON, but unfortunately I am not able to change this one).
The following code snipped will transfer the given parameters (in a loop) to a Map, which can then be transformed to jso... |
So, I made a tiny (~2 KB, <100 lines) library for simple flat-file data storage.
How it works is, you define a file to be used, and then you can add/read/modify/delete objects as "keys" to/from the file.
All the code is on github, but I'll put it here too:
varDx.php:
<?php
namespace varDX;
class cDX {
private $dat... |
The Wikipedia article about the Collatz Conjecture has these quotes:
If the conjecture is false, it can only be because there is some starting number which gives rise to a sequence that does not contain 1. Such a sequence might enter a repeating cycle that excludes 1, or increase without bound. No such sequence has be... |
This is my attempt at making a class for dynamic PDO queries in PHP.
The code works, but I would like the hear what I can improve to make it more secure and readable.
class DB
{
private static $connection;
public static function setConnection ($connection)
{
static::$connection = $connectio... |
This scrapes the titles and descriptions of trending YouTube videos and writes them to a CSV file. What improvements can I make?
from bs4 import BeautifulSoup
import requests
import csv
source = requests.get("https://www.youtube.com/feed/trending").text
soup = BeautifulSoup(source, 'lxml')
csv_file = open('YouTube Tr... |
I decided to give Go a try and implemented a Game of Life Kata exercise in GOLang. I have no prior experience in Go and the majority of my experience comes from Java, C#, and Python. My code appears to be working as intended but not sure if I've implemented it in the GO way, or idiomatic Go.
I've seen a few Go examples... |
For python 3.6.5 using graphene-graphql and mysql-connector
Context:
I wrote an API using graphene, a python graphQL implementation, this is actually my first time using the graphQL specification so I'm looking to improve my code implementation for the resolvers using a MySQL database.
As you may know, GraphQL isn't ti... |
This is some code which prints a hexdump of a list of 16 bit numbers, at 16 bytes distance for each, after the "print data" comment:
#!/usr/bin/python3
# creating test data
data = []
for i in range(500):
data = data + [ i & 0xff, i >> 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
# print data
c = 0
out = ""
for i... |
So I'm working on a game framework and one of the things I need are access to stateful "services" that can be accessed from all over. I was initially going to use the Singleton pattern but decided to try and come up with alternatives to avoid the short comings of that pattern.
So here is what I've got so far.
Main.cpp
... |
The use cases I’m facing require me to have a C++ data type that can store and manipulate the state of somewhere between 400 and 500 bits. In addition it is necessary to be able to store that state within SQL server databases in an efficient manner, i.e. not wasting unnecessary space because there will be a lot of such... |
Task
Write a Program that requests the user's first name and then the user's last name. Have it print the entered names on one line and the number of letters in each name on the following line. Align each letter count with the end of the corresponding name, as in the following:
Klaus Dieter
5 6
My Try
#includ... |
This is a button that changes text and icon according to a Boolean state. for example, a play / pause button or a connect / disconnect button. The icon uses Segoe MDL2 Assets as the default font, but you can edit the template to change to another!
The code:
public class StateImageButton : Button
{
static StateImage... |
Given an R x C grid of 1s and 0s (or True and False values), I need a function that can find the size of the largest connected component of 1s. For example, for the following grid,
grid = [[0, 1, 0, 1],
[1, 1, 1, 0],
[0, 1, 0, 0],
[0, 0, 0, 1]]
The answer is 5.
Here is my implementation:
def l... |
I have implemented a DialogueBox class which can be static, singleton, service locator, etc.
I have written it as a singleton pattern and implemented it in Unity3d engine. It is a part of a game.
I have ShowDialogueBox method with many parameters. How can I handle it?
The parameters are message, ok button label, cancel... |
There are some exercises about islands and water. I have seen other solutions in Java, but they are developed in procedural style in one-two methods. I tried to develop an object-oriented solution with code reuse. I have never got code reviews before, so I would happy to see any suggestions to improve my code.
Exercis... |
Here is my improved version of my Magic square program from following this earlier version.
I also added a few comments.
Any help for improvements would be really appreciated.
import java.util.HashSet;
import java.util.Scanner;
public class MagicSquare {
private int[] square;
private int[] row_sum;
privat... |
I'm somewhat new to python and wrote this piece of code to do a string comparison of accounts that are being requested for import into our data base against accounts that are already present. The issue is that the accounts currently in our DB is over 65K and I'm comparing over 5K accounts for import causing this code t... |
In a past course one of the assignments was to write a program that can compress files using Huffman Tree algorithm, and uncompress the files that the program generates.
My design is to count the byte occurrences first, then construct a HT based on the counted byte frequency.
My compressed file format is 256*4 bytes of... |
I have implemented a program in C to crack passwords by generating all possible combinations of words ([A-Z][a-z]) up to the length of 5. While the program works, I would like to receive comments on the efficiency of the algorithm and other design decisions that would improve the code. The exercise is part of the cours... |
There is a remote Windows PC that has access to "landline" unmetered WiFi and there is a Verizon 4G LTE MiFi (metered WiFi) as backup. This script checks to see if the PC is connected to any WiFi, connected to metered WiFi, or has any internet connection. It will be called a few times a day by Task Scheduler. Everythin... |
I am creating a machine learning tool set from scratch in python. I have never done something of this kind and I don't usually use python but I thought it would be good to expand my horizons. I am really looking for aspects of the code that would really hinder performance and things to consider since this will be used ... |
I wrote a small emulator for fun. Full code @ bottom of post, available on GitHub here.
Design choices:
modeling 16 bit little endian memory — opted for ctypes and array-like access via __getitem__
Enum library
Opcodes - convenient to access: the order of the opcodes in the enum matches the opcode's numeric value whe... |
This is my first code review question in here, so kindly guide me if I need to format the question in a better way.
Task Description
Aim of the task is to create a set of methods that would allow me to create random values for given primitive types. This would be used later in a method that would reflect on a class/st... |
I wrote this to sort of gauge my understanding of the bare basics of C++.Could you guys give me any pointers? (Ha, get it?). I would happy to hear what you have to say about the code. Also is it neat (aesthetically as well as functionally)?
#include <iostream>
bool end = false;
int w_combinations[8][3] = {{0,1,2},{3,4,... |
I wanted to create a relatively universal way of serialising an object, by doing a memcpy and generating a unique type ID. Stored together they can be used, for example, by another thread to restore a copy of the object for further processing.
This is used, for example, where one tread has a logging function requiring ... |
This is my first attempt to implement a crypto algorithm.
I am using C and gmp to interact with big numbers.
I am basing my implementation of the RSA algorithm from the book "A handbook of applied cryptography" (chapter 8.2) :
Take two distinct, large primes p and q
Ideally these have a similar byte-length
Multipl... |
This program counts the number of the occurence of each character that is used in a file.
I tried to use everything that Java offers to me properly. If you have tips which library functions would have been better, how to make the code more readable, than let me know. If you have a tip how to improve the performance I ... |
I wrote my own implementation of strlen and strcmp from C in x86 FASM and I would like to know is there anything that should be changed or improved.
strlen needs string in eax and is returning length of that string into ebx.
strlen:
mov ebx,0
strlen_loop:
cmp byte [eax+ebx],0
je strlen_end
... |
I wrote an algorithm to transform mouse screen coordinates within an isometric map to corresponding coordinates of an underlying 2D-square grid. The algorithm works and I tested it successfully. I wanted to post it here so interested people could maybe check the algorithm and see if I can make any optimizations beyond ... |
Here is part of my implementation of reading a Kinesis stream. I am not confident that this is the best way to implement synchronizing returns from goroutine.
Assuming there are N shards in the stream, the code spawns goroutines for each shard in the stream for processing. Goroutine-N works indefinitely until the under... |
I wrote this small program to open a .torrent file, retrieve its info-hash and size. I'm still a beginner at Python so the main focus of this program was to try and utilize classes and objects instead of having just a bunch of functions. It works but I wanted to know if this is a good design. Also, I feel some of the c... |
This is my implementation of a string class similar to std::string and supports the following:
range-for loops
iterators
basic utility functions
exponential capacity increase
operator overloads
I am looking for specific reviews on implementation of iterators, exponential capacity increase, usage of noexcept and imple... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.