# Tagged Questions

Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

12 views

### Recursive Implementation of Merge Sort C++

I am currently reading an algorithms book and I read on the insertion and merge sorts. I implemented the merge sort in C++, The first function MERGE is responsible for the merging of the two subarrays ...
40 views

### Generate dictionary of points on n-sphere

This is a long-shot, but my question is to simply optimize this particular function in some code I have written: ...
15 views

### Forecasting function using auto.arima for 15 samples of data

I have a workbook with data sampled. i have multiple samples based on date range. one sample starts from january, where other can start from february and so on. I need to build forecasting function ...
19 views

### VBA - Cycles through a table to find the cheapest bearing that passes

I have written several VBA macros to run on an excel spreadsheet. Inputs are entered into a table and then the macro is run; it cycles through a table of Bearings (in price ascending order) and ...
50 views

### 3Sum implementation

I have recently started to work through the problems on Leetcode, for the sake of bettering my own skills as well as preparing for interviews. I was faced with the 3Sum problem which is: Given an ...
47 views

### Sum of all paths between all pairs of nodes in a tree

I'm trying to solve a competitive programming problem. It basically gives a undirected graph (tree-like: no multiple paths between two nodes...) and asks for the sum of all possible paths between any ...
50 views

### Get a list of indexes for list A based on criteria in list B in Python

I have one list of data with duplicate IDs and a second list of data with attributes for the IDs. ...
54 views

I need to be able to atomically add a 32-bit floating point value to a location in memory. Here is what I came up with. While the code is Windows-specific, I'll extend it with Linux support using <...
427 views

### Poker hand probability — tally best 5 from all combination of 7

Related to Poker Hand Evaluator. This it not the same. This is take best from all combinations of 7. The other is all combinations of 5. Poker is 52 cards - 4 suits and 13 ranks: Texas holdem Hand ...
32 views

### building a search functionality

I am trying to search account table by providing a search string. I am building a query based in different conditions and then adding the returned records in a list. The functionality is working ...
22 views

### Hotkey detection for UI elements

I have several UI elements that can be opened using hotkeys for example the settings menu's key is Escape. The problem is that I have the Keycode stored in ...
1k views

### Taking arbitrary length input in C

Instead of having to use something like char buf[100500] and hope that no possible user input could be longer than 100500 bytes, I decided to make the following ...
91 views
+100

Following this website I wrote a neural network which uses the MNIST training data to recognize digits. The author writes that it should take a couple of minutes to train the network with 30 epochs of ...
26 views

### Single request weather app using ForecastIO service

I needed a web weather for a app that talks to ForecastIO API. Basically that sent a request to https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE giving me ...
62 views

### Extracting time duration in the session from 30 million rows

I am looking for making my code faster. I am working on yoochoose recsys 2015 dataset.. and trying to perform some transformations.. [recsys2015], it has got 30 million plus rows of data. The goal of ...
99 views

### Revised - Game of Fifteen

This is a revised version of a previous post. I attempted to address each aspect of the feedback provided. The key changes are as follows: Replace the deprecated ...
64 views

### Concatenating two substrings to provide the largest possible palindromic string

The code extracts two substrings from different strings and concatinating them to provide the largest possible palindromic string. Objective: You have two strings, (a) and (b). Find a string, (c),...
32 views

### Efficiently calculating differences between file using diff file

I'm using SVNKit to get diff information between two revisions. I'm using the diff utility to generate a diff file, however I still need to parse it into numbers. I implemented a solution, but it is ...
51 views

### Python matrix implementation

I created a simple matrix implementation and would like some critique of it, for example: Things I could add to make it more useful Ways I could make it more efficient (for example __pow__ or ref()) ...
83 views

### C++ Queue Implementation

so I wrote a queue implementation in c++ and even though I know the code probably isn't as robust as it should be and probably doesn't perform all the checks it should, I'd like to know mostly if ...
357 views

### Save the Prisoner

A jail has prisoners, and each prisoner has a unique id number, S, ranging from 1 to N. There are M sweets that must be distributed to the prisoners. The jailer decides the fairest way to do this is ...
34 views

### Getting the smallest snippet from content containing all keywords

This returns the smallest snippet from the content containing all of the given keywords (in any order). This provides the correct solution but I would like to know if it can be made more efficient. <...
183 views

### Poker Hand Evaluator

Poker is 52 cards - 4 suite and 13 rank: Hand is exaclty 5 cards Order of hands Straight-flush - all same suite and in order Quad four of same rank Boat three of one rank and two of another rank ...
69 views
+50

### Find installed and available Windows Updates

I have a function that uses Windows Update Agent (WUA) API through COM using the win32com.client module, part of pywin32 package for retrieving the installed and the available (not yet installed) ...
49 views

### Optimizing Java HTML parser

I wrote a program that goes through a webpage and returns matches of regex. I used it on my letterboxd.com account to go through all of my movies (over 900 entries) and then find genres field for each ...
36 views

### Find offset that minimizes squared difference between two vectors of different size

I am working on a project where the hotspot is some code that is supposed to find an offset, such that the squared differences between a reference vector and a given vector becomes minimal. The core ...
119 views

### Game of Fifteen - A Sliding Puzzle Game

Update: I addressed the changes and created an updated post. I'm reviewing C by working through the edX CS50 problem sets. This task was to implement Game of Fifteen aka 15 Puzzle. Project details ...
20 views

### Functional Merge Sort

I just finished this Merge Sort in Clojure, structured according to ex. 22-26 of this workshop. The main question I have can be answered without spending time understanding the code: ...
37 views

### Parsing shorts from binary file and finding the closest and furthest points

A few months ago I got rejected at the technical interview for a position. The problem that they gave me is the following: From a binary file, parse two shorts, x and y and build a Point object with ...
12 views

### Efficient ways of looking for start-key and processing data

This question is a follow up from my previous question. I am working with some wireless communication in Arduino. 979797 is the address of the transmitter. I have written the following code to ...
27 views

### Unbounded knapsack solution with items of equal value

My solution correctly solves the problem, but I would like to optimize its performance. For a capacity of 7 and bars = [ 4, 1, 1, 2, 1], the output is 7. ...
649 views

### 2-sum problem on a range in Python

Here is the problem description (from an algorithm course: https://www.coursera.org/learn/algorithm-design-analysis): The goal of this problem is to implement a variant of the 2-SUM algorithm (...
633 views

60 views

### Process bytes and check for start key

I am working with some wireless communication in Arduino. My data will be wirelessly received like so: 97 97 97 ... ... 979797 is the address of the transmitter. ...
55 views

### Query for a ticket system involving cases and casts on many attributes

I have this SELECT statement that inserts into a temp table and it is slow! Right now it takes ~1500 ms to run and only deals with ~7000 rows. As the data grows ...
497 views

### Python search for array in large text file

I asked similar question at: http://stackoverflow.com/questions/38410982/superfast-regexmatch-in-large-text-file ...
39 views

### Android music-streaming app

This is my first time building an Android app or even using Java in the first place. All of this code does work, but I'm hoping to optimize it or find out if things could be done more easily than how ...
27 views

### Fade and slide animatable elements on window scroll

I wrote a simple JavaScript function to animate objects on my webpage to fade and slide in from the bottom of the screen when the user scrolls them into view. I did this by using JavaScript to add ...
146 views

### Update bitmap in picturebox with data from a socket

I'm working on a screen sharing project, and I receive a small block of images from a Socket constantly. I need to update them on a certain initial desktop bitmap I ...
85 views

### I CAN HAS EULR 14, PLZ?

A few days ago I found myself learning lolcode. It turns out it's (almost) a real language and capable of handling (pseudo-)serious problems. So, let's try some (pseudo-)serious code this time. ...
23 views

### Generic Pairing Heap Performance

I have made a generic pairing heap library in C. Pairing heaps are one of the several heap variants with better asymptotic running times than standard binary heaps (others include Fibonacci heaps and ...
68 views

### Generalized Project Euler 2: A sledgehammer to crack a nut

The task at hand I have previously asked about how optimizing Project Euler 1. See Generalized Project Euler 1: A sledgehammer to crack a nut. In this question I wanted to explore the next problem: ...