instruction
stringlengths
71
95.1k
Context I'm doing Advent of Code as a way of learning Rust, and have a working solution to Day 8, Part 1. This involves moving between nodes, starting at AAA and looking for ZZZ, where the next node is determined by the L/R instruction chain in the first line. We loop over the L/R instruction set until ZZZ is found. So...
I'm a newbie to PHP and other programming for that matter. I'm doing this simply to learn. Figured the code could be used to search through a police database or something. The statements are Microsoft SQL Server. I'm running rocky Linux 9 with the unixODBC drivers in order to accomplish the task. I'd be happy to provid...
For learning purposes I am trying to make a encrypted chat in Python using Websockets. I am using AES and RSA to make it safe. The idea of the chat is that it's a group-chat. Users can join a chat by running python3 client.py --password=pass123. This is how it works. The server has already generated a RSA keypair. The...
Here's a script I wrote to automate testing for multiple sample files across two solutions, aiming to streamline the process. The script, provided below, compares expected results with the output of the solutions. #!/usr/bin/bash test_results() { expected=("${@}") i=0 for file in *.txt do resu...
I have implemented the Preconditioned Conjugate Gradient (PCG) method for solving a system of linear equations in Python and I would appreciate it if someone could verify its correctness since I am quite new to programming and using Python. However, I am not entirely sure if it’s correct for all possible inputs. I woul...
I have a Dockerfile with ubuntu:22.04 as a base image and a manual Python installation(specific version i.e., 3.11.1) layer which takes a long time. How to cache this manual Python installation layer in the docker image in subsequent CI runs in GitHub actions? Dockerfile: FROM --platform=linux/amd64 ubuntu:22.04 as bas...
Part 1 Today's task involves extrapolating the next value in sequences, given in this format: 0 3 6 9 12 15 1 3 6 10 15 21 10 13 16 21 30 45 The task is to extrapolate the next value of the sequences, by computing the difference between adjacent elements, and iterating on the resulting sequence until all the items a...
For learning purposes and because it really interests me I am trying to get a better understanding of cryptography by trying to make my own basic secure chat-application. I posted a first version of my attempt here. There were a few flaws in my implementation: My implementation was not E2EE because my server acted as ...
Part 2 I'm not sure if my solution covers all edge cases. The puzzle goes as follows: Given some input like this: 467..114.. ...*...... ..35..633. ......#... 617*...... .....+.58. ..592..... ......755. ...$.*.... .664.598.. We're looking for * symbols ("gears") that are adjacent to precisely two integers, and compute ...
Each screening has an assigned room and the room has seats. I need to display the seats for the given screening with information if it is free. The way I do it now is that I get the id of the screening, I download the screening, I take the id of the hall from it, then all the seat id of the tickets for that screening a...
In my project, I want to search for an item of a given type in a std::tuple at compile time. The given type might not be present in the tuple at all, in which case some invalid value should be returned to signal that. I'm using c++17 by the way. template<typename Arg, typename... Args> struct contains { static cons...
Part 1: The challenge involves analyzing recorded games where an Elf reveals subsets of cubes in a bag, each identified by a game ID. The goal is to determine which games would be possible if the bag contained specific quantities of red, green, and blue cubes. For example, the record of a few games might look like this...
// ms is expected to be between 0 and 2000 // fakeDouble is expected to be {0, 0} // uint64_t isn't used because it doesn't work with /NODEFAULTLIB when compiling 32-bit void msToDouble(uint32_t ms, uint32_t* fakeDouble) { if (ms == 0) { return; } else if (ms >= 2000) { fakeDouble[1] = 0x4000000...
My sister is organizing a Majong tournament. She wants to set up a set of round-robin rounds. There will be 16 players at 4 tables; 4 players per table. Players will play 5 rounds. She wants every player to play with every other player. I analyzed this problem and determined that in each round every player would play w...
This logger is for a game engine I'm writing it has a core side which is the game itself and a client side which is the engine. The architecture of the code I feel like is messy it has the main log files which is a .h and a cpp and each client and core has its own .h and cpp file. Is there any way I can improve this lo...
This is a follow-up to the question asked here: Advent of Code 2023 day 1: Trebuchet (Part 1 and 2) Changes made: The code no longer assumes that all lines will fit into a fixed-size buffer. Although a fixed-size buffer is used, the code now checks whether a partial line was read. It continues processing and updating ...
I'm new to React Native. I wonder if the following project file structure is ok to use for the rest of my project. Here is an example of component: import React, {useMemo} from 'react' import {StyleSheet, View} from 'react-native' import {Text} from 'react-native-paper' // Import the hook that give me my theme variabl...
When I was working on my game engine, I needed to know if a game object has been destroyed or not. So, I decided to use std::shared_ptr. But the standard shared pointer is not able to delete the managed pointer before the usage count reaches zero. So I decided to write my own implementation. This is the header file: #...
I'm using .NET 4.7.2. I have this code which should document changes between Person objects: public class Person { public string Name { get; set; } public int Age { get; set; } } public class Change { public string FieldName { get; set; } public string FromValue { get; set; } public string ToValue ...
I have this code, but I need to return pure functions instead the mutating functions. Is it possible? Perhaps using OOP? I don't know how to improve it. I tried to return the values in each function, but I haven't had success. import { AssetStatusType } from '@domain/interfaces/common' import { BothComponentType, ...
I made a complete little platformer game as a code snippet. The goal is to try to keep jumping on the enemies without touching the ground to increase score. I used Tad's Basic Game Objects, an open source set of JavaScript classes. What do you think of the code? (function() { let map = [ [3,3,3,3,3,3,3,3,3,4], ...
Part 1: The task involves determining the total points of a set of scratchcards. Each scratchcard contains two lists of numbers: the winning numbers and the numbers the player has. Points are awarded based on matches with the winning numbers, with the first match earning 1 point and each subsequent match doubling the p...
I was having concurrency issues with my ASP.NET Web API 2 project with .NET Framework 4.6.2. (EF 6), although it has been live on production that has been running for more than 1 year, this problem has just arrived from a customer. I sent two concurrent requests to this specific endpoint from Postman, 2 records need to...
A table that gets updated with new values as soon as they arrive. Each value is in its own row: An array of objects representing each a quote (ticker and price) let array_of_quotes = [ { ticker: "AAPL", price: 999 }, { ticker: "AMZN", price: 957 }, { ticker: "GOOG", price: 959 }, { ticker: "YHOO", price: 225 }...
I have tried to implement a queue from scratch, and it doesn't really seem to match what i found on internet, and I am wondering if this is a correct implementation, and what makes using Stack different from Linked Lists? namespace DataStructures { internal class Queuez<T> { static int MAX = 1000; ...
This is my first C program I just wrote in like 30 minutes and I was wondering if you could give me any pointers on ways to improve this. I'm decent at programming (around 5 years experience), but have no experience with C so I imagine I'm not following the proper idioms and/or doing things properly. Note: I didn't mak...
I'm currently practicing for the british informatics olympiad by doing past papers. I was doing question 3 of the 2019 paper: A set of children’s blocks, each illustrated with a single different letter, have been chained together in a line. They have been arranged so that it is not possible to find three (not necessar...
#include <stdint.h> #include <stdarg.h> #include <stddef.h> #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include <windows.h> HANDLE inHandle = INVALID_HANDLE_VALUE; HANDLE outHandle = INVALID_HANDLE_VALUE; #else #include <unistd.h> #endif int stdoutFunction(const char* buffer, size_t bufferSize) { #ifdef _WIN32 i...
Background Consider this trivial dataset: x y 1 1001 A 2 1002 B 3 1003 C 4 1004 D 5 1005 E For an R programmer, it is easy to subset this arbitrarily by position: dataset <- tibble::tribble( ~x, ~y, 1001, "A", 1002, "B", 1003, "C", 1004, "D", 1005, "E" ) dataset[c(4, 1, 3...
I am working on a watermark removal project using OpenCV in C++. The goal is to recover the background from a composite image by separating it from the foreground (watermark). The code processes the image in blocks and applies some matrix operations to each block. While functional, the code's performance is slower than...
I'm solving a python exercise. Here is a brief description: Please write a function named find_words(search_term: str). It should return a list containing all the words in the file which match the search term.The search term may include lowercase letters and the following wildcard characters: A dot . means that any s...
The task involves determining the lowest location number corresponding to a given set of seeds by following numerical mappings for soil, fertilizer, water, light, temperature, humidity, and location. The almanac (your puzzle input) lists all of the seeds that need to be planted. It also lists what type of soil to use ...
I've started to write a header-only implementation of callback for member functions : #include <cstddef> #include <utility> namespace _callback_internal{ /** \internal * A Type list to store variable argument type */ template<typename T, typename... Args> struct TypeRecList{ template<size_t n, bool dummy = tr...
I wrote this blackjack game for my APCSA class (already submitted) and was wondering if anyone had feedback on what parts of it are improperly written. My main concern is the fact that I am printing from my object bodies, and I don't know if that is bad practice. Additionally, does anyone have an idea of how I would go...
I am trying to make an is_integer template function to determine a number is an integer or not. The experimental implementation is_integer Template Function Implementation template<typename T, typename TestT = double> constexpr bool is_integer(T input) { TestT floor_input = std::floor(static_cast<TestT>(input)); ...
I've been working on a byte-oriented SHA-256 implementation for educational purposes. I then tested it using the NIST CAVP tests found here. All tests pass but I would appreciate some feedback from a third party (especially regarding things I may be too involved to see like pointer errors or performance improvements th...
I am trying to build a useable NLP corpus but getting bottlenecked by how long the program takes (200 hours). With so much data I know that optimizing my code even a little bit will net me huge time savings down the road, so I wanted to post this code and ask for some advice on speeding it up. I added a parameter to lo...
I've encountered a readability issue in C++ when comparing the length of a vector to a scalar. Commonly, I see solutions like this: Vector<float> v{23., 42.}; if (v.lengthSquared() < 8 * 8) ... While this works, it's not very readable. I believe a more intuitive approach would be: if (v.length() < 8) ... To achieve t...
Looking for a better approach to write below transformation using Python. Is it possible to avoid loop and still achieve the desired output? It is too slow for 10 million rows. #Below code calculate premium split for each policy #import modules import pandas as pd from datetime import datetime from datetime import ti...
I wanted to make a small self-integrated API for my PyQt5 application. This class is a tiny chunk of the whole project: class NyvoNetHunterRequestManager(QObject): sending_request = pyqtSignal() request_sent = pyqtSignal() failed_to_send = pyqtSignal() received_valid_response = pyqtSignal...
I have a function which is supposed to trim a string by removing trailing whitespace, then exactly one instance of a fixed string, if it exists, and then any remaining trailing whitespace. It works as intended but I'd like to do this neatly just by using views. Is there a clever and efficient way to do that? Also, I...
Starting with the following list of initials and last names: ['Arnold-Ker L.', 'Dutra Da Silva R.', 'Bracciali D.', 'Dlouhy L.'] I need to extract the full names from the following string: arnold-ker-lucas-dutra-da-silva-rogerio-bracciali-daniele-dlouhy-lukas The following function: def get_full_names(player_name_str...
I have a Timer in my View right now, but I want to move it outside to my ViewModel-class. I have experimented a bit and came up with a working solution. The code works and produces expected output, however I'm not sure if I have done everything in a proper way, so I would like some input on my code. Would you do it in ...
THE TASK: Given an NxM "chess"board and Q,R,B,K where Q is the number of queens, R the number of rooks, B the number of bishops, and K the number of knights find out how many possible configurations of such pieces there are where a capture isn't possible in the next move. Even though this isn't really a chessboard or a...
I have this pie chart. It encodes data points in three dimensions, which are encoded via sector radius, sector angle, color intensity of the sector. How it looks like? (See here.) Code com.github.coderodde.javafx.PieChart3D.java: package com.github.coderodde.javafx; import java.util.ArrayList; import java.util.List;...
Background I found myself needing some M equivalent of cumsum() from R. After some frustrating research, I discovered that there is little support for cumulative operations in PowerQuery. I set out to implement a function for cumulative summation, but I soon realized this approach could be generalized to any list func...
Part One: The task involves organizing multiple toy boat races, each assigned a specific race time and a recorded distance. To surpass the existing record, participants must optimize the duration of holding the button, as the toy boat's speed increases by one millimeter per millisecond for every whole millisecond the b...
I've been trying Advent of Code challenges to learn Clojure. I've successfully completed Day 2, but I feel like my solution is very clumsy, especially the functions for parsing text input. Instructions: Imagine there is a sequence of games played, encoded in a text file, one game per line. Each game consists of an id a...
I'm trying to reduce the complexity of this piece of code following a SonarQube error. I have several similar blocks, and even if I try to extract them into private methods, the Sonar error persists. There is the code : if (contratPPH.getPieceIdentite() != null && fichePersonne.getPieceIdentite() != null) { if ...
This is a generic implementation of Knuth's "Algorithm X" using dancing links. The whole code with a "mandatory" sudoku solver can be found at gitlab. Regarding the scope of the review, I am an experienced programmer and I think I "should" know what I am doing, therefore you should not consider any issue to be too smal...
I don't find an implementation in the library I work with of covariance function: I give a try at implementing it in Python: import numpy as np def covariance_dirichlet(X,alpha): cov_list = [] sigma = np.sum(alpha) for i in range(0,len(X)): for j in range(i+1,len(X)): if i == j: iter_val_num = ...
Below is a simple method which compares contents of two excel files ignoring the line order. This method is working as expected. But, one of my peers in their code review mentioned that initializing and using 4 sets for this might not be the best way performance/memory-consumption wise and that the code can be optimize...
made a Firefox extension for resuming videos, because on Firefox Android, YouTube videos that have been out of focus for a while, reset their playing time. There already exists a firefox extension for this, but it does not actually work on Firefox Android, despite being marked as Android-compatible, so I made my own wh...
I was trying to write code that would get as input a recipe consisting of item materials and would create all possible recipes that could be used to create craftable of the recipe. The Recipe is represented by this data class: private data class RecipeTree( val materials: List<Material>, val craftableID: Long, ...
Background: I am in earlier stages of implementing a standard on top of an existing 'backend' This standard requires that I send data in UDP packets of a size specified at runtime All packets must be the same specified size except the last, which can be smaller The backend interface supplies me with a number of pointe...
I'm a beginner with scraping with Selenium. And I wrote a couple of scrips. And when the script is used for a website with 10-15 pages, it works as it should. However, when I use it on a larger website, like the one in my example below, it takes quite literally more than an hour to execute. Is that normal for this amou...
I am a programmer with a primarily Rust-based background who has nonetheless taken an interest in C lately due to its simplicity and minimalism. However, one of the things I miss most from Rust is safe memory management. So I created a "smart pointer" of sorts to replicate that experience: #include <stdio.h> /* This ...
This is an app that generates random statement types, and basic conjunctions. How to improve its readability and function? How to deploy this code app online? This is the GitHub repository: https://github.com/attilavjda/shiny-goggles #paragraph_builder.py from flask import Flask, render_template from random import cho...
Which is more elegant out of two methods as mentioned below mostly from memory prospective? Both methods achieve the same result, but from a memory perspective, In Method1, we are storing the running total and count separately, using two variables. while In Method2, we are using a list to store all input values and the...
I've created my own AutoComplete form element based on @nextui-org/autocomplete to be able to use it along with react-hook-form. I am relatively new at TS, at least on generics, so I am not sure if I am overusing generics or have any mistakes really. // AutoComplete.tsx import { Autocomplete as NUIAutocomplete, Au...
Problem description: Write a method that takes in 2 parameters: A string containing either "A" or "B" indicating the recipient of a bank transfer. An integer array containing the amount for each of those transfers. So for instance, if the String is BA and the array is [1,2], it means A transfers 1 to B, then B transfer...
All line indices of lines from a text that begin with the same line prefix should be found. The prefixes and the corresponding line numbers should be returned. Streams and lambdas should be used as techniques if possible. The format of a line is always as follows: anyText_anyText_number_number where anyText_anyText is ...
To improve my coding knowledge can you please give me suggested changes on my code? class Solution(object): def findMedianSortedArrays(self, list1, list2): merged_array = list1 + list2 merged_array.sort() length = len(merged_array) medians = length%2 median = length/2 ...
I have this code for picking items with multiple values from userform and inserting them into a sheet. The code works perfect on my computer, which is pretty decent. But on a computer from work it runs very slowly, maybe because I'm abusing the "select" method. I ran out of ideas. Sub LSTART_DblClick(ByVal Cancel As MS...
I have a PR implementing differential evolution. I'm a bit concerned about the implementation and would like some feedback: The class could be a free function. However, there are so many parameters, the templates become unwieldy and getting arguments out of order seems so easy. So I split it between constructor and me...
The implementation reads sequentially the user's input changing the type to build according to user choices. There are two main components a conditional structural sharing (Conditional) that runs code with preconditions... import java.util.function.Predicate; public class Conditional<T> { private static final Con...
This is a follow-up question for Two dimensional gaussian image generator in C++. Besides the two dimensional case, I am trying to implement three dimensional gaussian image generator which with additional zsize, centerz and standard_deviation_z parameters. The experimental implementation gaussianFigure3D Template Fun...
Here, is there any efficient way to load en_core_web_mdmodel without importing whole spacy module? It takes a significant amount of time to load the python program. import spacy from spacy import displacy from spacy.matcher import Matcher, DependencyMatcher nlp = spacy.load("en_core_web_md")
I'm building a little game that lets you generate a random sports league with random teams and random rosters. What are some ways that I can improve the readability and performance for this code? Main Code import csv import os import random import utilities.resources as resources import utilities.saves as saves from ...
I have created a program to find prime numbers up to the 32nd power of 2. It uses the sieve of Eratosthenes. I would appreciate it if you could let me know any bugs or improvements I can make. /* * prime32.c */ #include <stdio.h> char isprime1[0x10000]; char isprime2[0x10000]; typedef unsigned int UINT; void solv...
I implemented Conway's Game of Life in C++17. To make it easy to copy paste. I have merged my .h and .cpp files. Any improvements or any C++20 features that I can leverage are greatly appreciated. To run the code build it using cmake and run the following command cat .<Path_to_life_file>/life.txt | .<Path_to_bin_dir>/C...
Othello is a two-player strategy game typically played over the board. I implemented Othello in C++17 with CMake as the build system. I'm looking for feedback on cleanness, readability, and extensibility, in addition to the quality of the C++ (are there certain features I could have taken advantage of / are there feat...
I've implemented a config file parser in C++, which I may expand in future for personal projects. As of now the config file only supports floats, strings and booleans. The parser is based on various if/else statements and string stream for data extraction. The actual parser (conf_parser.h) #pragma once #include <strin...
Minimal React + debounce implementation. The user input is used to filter against randomWords directly, nothing asynchronous. React re-renders created duplicate debounced functions so I used useMemo as advised here. Let me know what can be improved: // NextJS: initialize Home as client-side component 'use client'; imp...
Now I have this simple message bus in Java. This one is as simplistic as I could get. Code com.github.coderodde.messagebus.AbstractMessageConsumer.java: package com.github.coderodde.messagebus; import java.util.Objects; /** * This abstract class specifies a message consumer. * * @author Rodion "rodde" Efremov * ...
Problem statement: Consider a scenario where a vector of very small tasks, each encapsulated within a class 'Task' with a thread-safe method Task::process(), needs to be efficiently processed in batches. We need to design an API processTasks (std::vector taskVec) It can be called multiple times. It needs to process ea...
I did the exercise of LearnCpp.com's Chapter 8 summary and quiz and I'm still learning… Question #3 Implement a game of hi-lo. First, your program should pick a random integer between 1 and 100. The user is given 7 tries to guess the number. If the user does not guess the correct number, the program should tell them w...
I want to sample audio as a learning process. In the future i want to make my dorbell "smart" and stream the audio via VoIP. But as beginning i want to sample a simple audio signal from my laptop (e.g. simple sign wave) and send it via UDP over the network and listen to it. As board i want to use a ESP32-12. Since i ne...
I have made a basic HTTP server implementation in Rust. I have used frameworks like Actix-web in the past but the purpose of this code was learning and experimenting. I wanted to work as "low-level" as possible. The code works pretty good and cool IMHO. It supports multiple HTTP-methods like GET and POST. It is possibl...
This was the first kata I found hard so I wanted to ask about it. Any ways I could I have done it better? here's the question -> Most frequently used words in a text def check_alphabet(string): #checks if the given string contains at least one alphabet for i in string: if i.isalpha(): return Tru...
I am a beginner and was hoping for some honest feedback on my js code. I struggled quite a bit on this, I did ask gpt to explain some concepts which I find it’s good for but wrote it all myself. // variable to store array of players const players = ['X', 'O']; // declaring currentplayer with array index let current...
This is a follow-up question for Three dimensional gaussian image generator in C++. Considering the suggestion from G. Sliepen: Structure of a 3D image Your 2D Image class is not storing a vector of vectors, rather it stores a single vector with all the pixels in the 2D image. But instead of creating a 3D image type, ...
I use this code to populate a DB with a batch of pokemon entries from the POKEAPI. Since I'm using TypeScript, I added some custom parsing to use the data's type in the code. I've used a mix of A instanceof Object and 'field' in A, but what would be a better way? On top of this, I'm converting data to the Result<T> typ...
I am currently working on integrating PayPal with my Laravel application, and it's my first time incorporating PayPal for production use. I have written the following code and would greatly appreciate your expertise in reviewing it for potential issues and ensuring its readiness for production. Objective I intend to us...
I currently studying OOP and related design patterns, and tried to implement random data generation for some stock charts using OOP as an exercise. This code randomly generates data points for 3 parameters (share price, spread and yield), so it later can be used as an input for the graphs. I want to receive some feedba...
Now I have this repository. It's a key logger logging all the keyboard events possible. Note that some programs do not "leak" the keyboard events outside of their GUI. For example, Notepad++ is such a program: whatever you type in it, stays in it. As additional fun, in order to not abuse the entire system, the data is ...
character_range aims to be an equivalent of the native range for str and bytes (currently there's no support for step and decreasing range however): lazy and intuitive. The code are fully type hinted with mypy as the primary type checker. There are about 750 LOC. Please ignore the code style. Algorithm suggestions, opt...
I have a code snippet here about 1D convolution in pure ANSI C code. Question: Is this most optimized C code, or can it be done in a more optimized way? In my opinion, I have remove all unnecessary statements and iteration. But is it enough? The optimization priority is: Speed #include <stdint.h> /* * 1D Convolution ...
To learn how custom derive macros work in Rust, I decided to create a simple derive macro to provide getters and setters for a given struct. It would be used like this: #[derive(GetSet)] pub struct Example { #[get] #[set] field1: String, #[get] field2: i32, } However, there are some things that fee...
I'm looking for a simple way to calculate the logarithm without using java.lang.Math, just out of interest. Here's my try (I adopted some code parts from this answer): public class Log { public static double log10(int x) { if (x <= 0) { throw new IllegalArgumentException("x must be positive. log...
Goal Please review code in fp.h and fp.c to index and compare floating point values. Background C code can perform floating point math, yet how good is it? One way is to test the floating point results of code at one precision against a greater, and supposedly more correct precision. (This assumes the higher precision ...
Is there a way to transpose a matrix in ANSI C way much better than this ANSI C code? Can I do transpose in a different and faster way? The focus of this aim is: Speed /* * Turn A into transponse A^T * A[row * column] */ void tran(float A[], size_t row, size_t column) { /* Decleration */ float *B = (float*)m...
I'm learning rust by implementing simple use-cases that are common and trivial in other languages. Recently, I decided to prototype a small component for retrieving some "config" from a remote source every X minutes. The local version of config should also be made available to the rest of the program. This is what I ca...
This is my solution to Leetcode problem 8, the atoi problem, in Python 3. This is just a generic atoi routine that converts any string into an integer. Front leading whitespaces are ignored, and there can be a sign '+' or '-' in front. 0x30-0x39 in ASCII are digits so subtracting 0x30 gets the digit. Consecutively mult...
Full code is below. Any feedback is welcomed. I am trying to implement syntax error reporting like GCC and other interpreters/compilers. I am sure this can be improved and hence why I was pointed to this part of Stackexchange from SO. Full program: #include <iostream> #include <string.h> #include <string_view> #include...
The only requirement is that it has to be done by pointers: And it returns the amount of removed numbers because of the way of output that is set in the main. The function, using exclusively pointer arithmetic, removes each occurrence of the second array delimited by q1 and q2 from an array bounded by p1 and p2 (where ...
Description: The task involves navigating a haunted wasteland on a desert island using a camel. The objective is to escape from the current position (AAA) to the destination (ZZZ) by following left/right instructions. Nodes in the network have connections, and instructions guide the traversal. If instructions run out, ...
How the List is Narrowed Down: Adjusts the director's birth date for leap years. Calculates the "A1" value for the director. Compares each candidate's birth date with the director's birth date using the "A1" value. Eliminates candidates based on birth year and a comparison with the director's birth year. Modifies t...
I tried to optimize heap sort algorithm. Instead of recursion, I used iteration: void max_heapify (int arr[], int heapsize, int i) { int left = 2 * i; int right = 2 * i + 1; int largest = i; do { if (i != largest) { int tmp = arr[i]; arr[i] = arr[largest]; arr...
I had to relax a bit, so I wrote this sorting algorithm. By any means it isn't fast, but I really started to get interested in it, since I haven't seen similar approach yet. Disclaimer I do not intend to make something revolutionary, but rather find another possible way to sort numbers, this algorithm was made due to m...