Questions tagged [algorithms]

In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning.

Filter by
Sorted by
Tagged with
2
votes
0answers
68 views

Algorithm to search very long blacklist in another very long data set

I have two data sets. The first data set has approx. 50.000 movie and song titles and the second one have 20.000 blacklist strings. I am looking for the best algorithm to detect movie/song title which ...
-2
votes
1answer
44 views

Finding the domain(s) of variables in a Linear Program using the constraints? (Constraint programming/Linear programming)

Forgive my jargon , as I'm not very familiar with Constraint Satisfaction Problem(s) or Linear Programming procedures (For eg: Presolve) I have very trivial constraint set from variables of ...
2
votes
1answer
43 views

Efficient and fair way to evenly distribute multiple items with various quantities

I am developing small lottery games where the participant can win one of many gifts, each having various quantities. (The code is in PHP) Simple scenario: I have 5 types of gifts, 1000 in total, and ...
-4
votes
0answers
28 views

Number Of Subsets [closed]

Given a number n, find all subsets from {1, 2,.. n} with the condition by taking 2 elements from a subset the absolute difference is greater than 1. I found this problem but I have no idea how to ...
3
votes
3answers
151 views

How to clone an object graph and keep relationships of objects intact?

In my ASP.net core application with Angular 2+ client, I work with a complicated object graph. In the object graph I have some objects with references to each other. I have a simplification included ...
1
vote
1answer
36 views

Finding Event-Oriented Patterns in temporal sequence

I have a 24 hour "sliding window" sequence of "start" and "stop" events in memory comming from an iOT device. I'm only interrested in finding "stop" events followed by "start" events in order to ...
1
vote
1answer
26 views

Synchronizing video playback in LAN over UDP (no master, same HW & SW)

I have devices thay play video files from their local disk basing on a pre-defined playlist (every device plays exactly the same movie in the same order, every device knows in advance what videos will ...
3
votes
1answer
97 views

Algorithm for fulfilling an order using pre-packaged goods

A manufacturer sells different flavour chocolates. Customers can place an order for any number of each flavour chocolate, from zero upwards. Some combinations of chocolates are frequently ordered, ...
-1
votes
1answer
44 views

How can I efficiently find out if X is in any of N ranges of L-R numbers?

This is part of a bigger problem, which is to find out if point XYZ exists in any of n (XYZ -> XYZ) "boxes". I'm currently splitting up the problem into a smaller one, by focusing on one dimension ...
1
vote
0answers
31 views

How to develop an Import/Export Functionality for my node application

I have a configuration application in Nodejs. It has a Component with name and uuid. A Component can have many Schemas. A Schema has a uuid, name, componentId, json. A Schema can have many ...
1
vote
1answer
157 views

Which class of problems is this?

I’m working on a problem which I will try my best to describe: You have a stack of 5 blocks: labelled A, B, C, D and E. You also have a set of rules giving points if certain conditions are met, for ...
3
votes
0answers
83 views

Using PostgreSQL MD5 hash to calculate a 64 bit hash value for advisory lock functions?

I have a particular problem addressing the PostgreSQL advisory locking functions using the bigint variants. Basically I want to create a 64 bit bigint value from a text type obtained with the ...
0
votes
1answer
52 views

Need to test for equality on vector clocks

I've heard about vector clocks and how to test if a message was sent before another message. E.g. Message A was sent before message B if every element of the vector of message A is smaller or equal ...
-2
votes
1answer
59 views

Prune Certain Tree Branches with AI [closed]

Where I live there is a pear industry. Many farmers have pear trees and it happens that those trees need to be pruned every year in order to grow stronger and give better fruit. The problem is, it ...
0
votes
1answer
33 views

Is there a best practice for scheduling forecast notifications?

Let's say we write an application that can use multiple forecasts from different sources. It does not really matter what type of data we are talking about, ofc. it can be weather forecast, stock price ...
2
votes
2answers
82 views

How to generate “meaningful combinations” from the set of characters?

There is a set of feasible characters, say ABCDEF. Combining some of them, I can generate some "meaningful" combinations, say CAFE. I want to gather all of them. To do that, I can just "walk through" ...
-2
votes
1answer
92 views

How to represent in a flowchart data fetched from a database

I have an existing piece of code that uses a database. In order to understand its algorithm, I try to represent it with a flow chart. In this algorithm I need to fetch some data from the database in ...
-1
votes
1answer
59 views

Algorithm for calculating daily profits from user's balance minus deposits

Calculating a user's daily profits / losses using their previous balance and their current balance (let's say for things like financial portfolios) is pretty trivial. The part I find difficult is how ...
2
votes
1answer
30 views

Quantity allocation algorithm performance

I have a scenario for which I'll take an analogous example to help understand better. There are N buckets of known varying capacities. We have M balls that we need to put in these buckets to fill ...
1
vote
0answers
16 views

How to implement item based collaborative filtering on android using CSV dataset

I have developed an android application on food delivery where I have used Firebase to store and retrieve data. I wanted to implement collaborative filtering algorithm on my dataset and I am stuck on ...
2
votes
5answers
112 views

Detect frequency pattern in a list of dates

I have a list of dates in which a certain event happened. Taking into consideration that a particular occurrence of the event can: Be a one time thing or Be part of a periodic series, which happens ...
3
votes
1answer
98 views

How to guess which pieces of text belong to which lines in a scanned document?

I want to be able to analyze a five-years archive of supermarket receipts. The receipts are scanned, and thanks to Google Cloud Vision API, the result of an OCR is available. Google's API, however, ...
0
votes
0answers
79 views

Searching/Hashing Wikipedia - at each position for keys 1..31 long, the fastest way?

A C coder here. My wish is to find the best way to search words and phrases within the ever-growing English Wikipedia XML dump. As a first layer/step, hashing is the answer, yes? The problem is that ...
1
vote
1answer
109 views

Algorithmic approach to check wordlist phrase against MD5 hash [closed]

Say I have an MD5 hash. I need to decrypt. I also have a wordlist of 100.000 words, in an array. I KNOW that the MD5 hash consists of 3 different words, all present in the array. I dont know which ...
1
vote
3answers
100 views

Algorithm for random weighted boolean shuffles?

I don't exactly know how to phrase the thing I'm searching for in a succinct way, which also made it hard to research. In my application I need a random list of booleans, say of length five. The ...
1
vote
1answer
74 views

Designing a generic graph

I am looking at designing a Graph class, that should work for both lists and matrix. For ex: something like, class Graph { public: virtual ~Graph() = 0; virtual bool AddEdge(int src, int dest)...
1
vote
1answer
143 views

Does a Self-Balancing Self-Sorting Binary Search Tree exist?

When we are inserting into a self-balancing tree, can we also assume it is sorting itself using those same operations? Or rather is there a traversal method that gets us the elements as a sorted list?
0
votes
2answers
154 views

Scrabble Grid Word Detection Algorithm

I am building a scrabble game, and I have already a dictionary working. When the user will place letters on grid, I need to check that all the words are valid. Which algorithm can I use or how can I ...
-1
votes
1answer
71 views

Algorithm that maps consecutive whole numbers to sets of numbers

Where would I begin if I wanted to develop an algorithm that maps consecutive whole numbers to a long list of unique sets of whole numbers. For example: 0 = {0, 0, 0} 1 = {0, 0, 1} 2 = {0, 0, 2} ...
-2
votes
1answer
109 views

Map synchronization algorithm

Say I have two Map instances in JavaScript (or HashMap in Java, or Dictionary in C#), A and B. I want to synchronize B to A, so that B is a copy of A. I can't copy the reference and I don't want to ...
0
votes
1answer
62 views

Fuse 3D-Points in Bundle Adjustment?

I'm actually implementing my own Pose-Estimation/- and -Refinement pipeline. For this purpose I use one moving mono-camera. Then I take the consecutive images to estimate the pose and triangulate the ...
2
votes
1answer
393 views

Time complexity of a Nested While loop in a for loop

I'm trying to derive the simplified asymptotic running time in Theta() notation for the two nested loops below. For i <-- 1 to n do j <-- 1 while j*j <= i j = j+1 For i <...
4
votes
1answer
192 views

Is LRU still a good algorithm for a cache with diferent size elements?

I am currently working on a project where I need to implement a cache with limited size. The most common eviction policy seems to be Least recently used (LRU), that simply discards the least recently ...
0
votes
1answer
116 views

Do I have do use HashTables/Maps/Hashmaps in this algorithm?

I am doing the Ransom Note algorithm in Hackerrank. The thing is I am not using maps and all the tests pass except for three which execution time takes a lot more. (Kotlin language) I have two ...
3
votes
4answers
338 views

Finding largest sequence in 2D array

I'm practicing problems and found this weird one. I can't figure out the best way to solve it. You are given a 2D matrix size n*n with only 1's and 0's, you have to find the longest sequence of 1's ...
0
votes
1answer
61 views

Solutions to sort series based on smallest difference of derivatives

Consider a table of m columns where columns represents some smooth functions with potentially some minor noise. Each function is given for the same set of argument values. However, the rows in the ...
1
vote
1answer
155 views

Group overlapping intervals

Given a number of intervals: -- (1, 3) a - (2, 3) b -- (2, 4) c -- (3, 5) d intervals = [(1, 3), (2, 3), (2, 4), (3, 5)] I would like to generate the minimum number of groups so that in ...
2
votes
1answer
370 views

Failure to understand logic behind dice roll permutation problem

I am having a lot of trouble understanding the logic behind the infamous "Find total ways to achieve given sum with n throws of dice having k faces" question. After extensively searching for ...
-5
votes
2answers
184 views

Given an arbitrary function f, how would you go about writing a function g that replicates f's implementation?

You are given an arbitrary function f. You may invoke it with arbitrary parameters and read the return values, as well as record any exceptions it raises, but you may not read its implementation. How ...
2
votes
1answer
166 views

Big-O Notation and Calculus [closed]

I was wondering if there are any calculus relationships implicit in Big-O notation. For example, an algorithm linear according to Big-O notation reduces the size of the problem by a constant amount ...
4
votes
1answer
151 views

Generating all possible permutations in the fox, goose and beans problem

I have learned graph theory, and am using it to solve the classic Fox, goose and bag of beans puzzle. If we consider that there are three locations for each of the fox (X), goose (G), farmer (F) and ...
0
votes
1answer
39 views

Affiliate Marketing - How to track all sales on 3rd party website made via my application

I'm looking forward to the possibility of an algorithm or a way to track how much sale has been made on 3rd party's website because of my client so I can get the commission. For example if a user "A" ...
2
votes
0answers
37 views

What is the most efficient way to find filesystem changes in percentage?

I am planning to write a program that will produce digest logs for file changes in a particular directory. The idea is that whenever a file is deleted in a particular directory, it will show up in the ...
1
vote
1answer
68 views

Algorithm for picking seedbox to put torrent on

Which algorithm would be best for deciding which seedbox each torrent should go on? It must be able to fit the torrents in the minimum number of seedboxes, but also maximize the free space on each ...
1
vote
2answers
133 views

Architecture/algorithm for unusual recommendation system

There are thousands (or tens of thousands) of possible movie titles. New user enters my website and selects hundreds of titles that he likes. The only single goal of my website is to output the list ...
-2
votes
1answer
323 views

How to create a league scheduling algorithm?

Our requirement was to create an auto fixture generation tool that creates fixtures for a league with any number of teams, and where they have a fair distribution of home and away games so that: ...
0
votes
1answer
107 views

I have a data set of over a million addresses and I want to display the closest N locations to a given address or current location

I am a student working on a personal project which is essentially a location finder that will be on a website. I have a data set of over a million addresses and I want to display the closest N ...
-3
votes
2answers
314 views

What are some disadvantages for a hashmap with timestamp as key? [closed]

"What are some problems that can arise from using a HashMap with timestamp as keys"? I, for one, do not see any major issues with this kind of "setup". Is this "setup" a no-go/an anti-pattern/...
3
votes
3answers
234 views

Move the onscreen circle when camera moves

I have a script that accesses my webcam and displays the captured video on the screen. I can also very easily draw a circle (a rectangle, it doesn't matter) over the video. When I move the camera ...
3
votes
3answers
367 views

What is the most effective algorithm to evenly distribute n points on a 2 dimensional array so they are as separated as possible?

I am trying to code a game which currently uses a matrix ( that I am calling a map). On this map are islands which can be generated n times. The purpose of the algorithm is to distribute the islands ...

1 2 3 4 5 41