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
1
vote
0answers
38 views

Rectangle packing / Bin packing with multiple frames

I have multiple rectangular frames, with different fixed heights. The width should be minimized and there is a maximum width. Then there are many different smaller rectangles. These should be packed ...
-5
votes
1answer
32 views

Choosing 2 or 3 values out 3 values after calculating their closeness

I want to find a specific algorithm to choose either 2 or 3 out of 3 given values. Like if I have a set of values 10,11,12 all three are close enough so I will calculate the mean of the value and ...
1
vote
2answers
121 views

Collaborative graph exploration algorithm

Given a minimum spanning tree in an unweighted graph of (10 .. 500) vertices and (vertice_count .. 1000) edges. Each vertex can have up to 6 edges. Given K agents/bots/processes/etc.., all starting ...
2
votes
1answer
67 views

How to return “debugging” information during the execution of an algorithm

I was recently tasked with thinking about returning optional tracing information about the execution of a complex algorithm. It's the kind of data you need to analyse the inner workings - a bit like ...
2
votes
5answers
240 views

How can billion integer ids be stored and specific ones checked for existence most efficiently? (persistent solution, not just in-memory)

Let me preface this by saying that I am familiar with RDBMS. I have a solution using mysql/mariadb but I am not happy with the efficiency of the solution so I'm looking for alternatives. I'm trying ...
-4
votes
2answers
53 views

Booking Availability Algorithm

I've been tasked with creating a booking system and need to figure out when rooms are available at specific time slots on each day. There are 5 available meeting rooms that can be booked at fixed ...
0
votes
2answers
125 views

How to minimize size of data given the need for a null pointer?

So I don't know how to formulate this clearly, as it's quite confusing. Hence the reason for asking this question, to overcome the confusion. I will do my best to make it clear, but part of the ...
2
votes
2answers
171 views

Time complexity for a small code

I'm trying to find the time complexity for the following code. N= number of elements in array D= a constant: D>1 V= a constant: V>1000 counter=1; //the maximum value of the counter is N/D. ...
-3
votes
2answers
78 views

Recursion + Stack/Queue usage in practical life implementation [closed]

I am very new to Data Structures and Algorithms. I want to use recursion + stack/queue in a grocery store inventory program that I am making. However, I can't come up with any good ways of using ...
2
votes
2answers
108 views

Algorithm for rule-based sorting?

I am trying to plant a garden. Certain plants are good for some plants and bad for others, and I am trying to find the best order of plants: most adjacent friends and no adjacent foes, as defined in ...
-4
votes
1answer
36 views

What is the worst case Time Complexity for only the Divide Portion of the Merge Sort Algorithm?

Please, consider the below merge sort algorithm. Here we start with a divide portion which splits the array into halves and we do recursive operation on each half separately. I have ignored the merge ...
-1
votes
1answer
43 views

Resolving Dependencies and Incompatibilities Deterministically

Problem Description I'm working in Python and I've been having a problem designing something to handle the following (abstracted) system: I have some objects (lets call them Nodes) that can be in ...
0
votes
0answers
30 views

Assigning weights dynamically to ensure equal distribution

Scenario:- The load balancer distributes traffic to backends with a simple round-robin mechanism. With default config, each backend is assigned weight "1" so all backends are given equal chance of ...
-4
votes
1answer
44 views

Choose a most probable value from the list based on some text [closed]

Im looking for a good way to find a value from the given list based on a text. Example: This computer has 16GB ram and with the best processor in it. Case is made from aluminium. And I have ...
3
votes
4answers
233 views

An algorithm for self picking teams

Say I have 100 users, each with varying strength, and each with a top 5 set of "preferred teammates" and a top 5 set of "preferred enemies". I want to sort the users into two teams. User { int Id;...
0
votes
1answer
67 views

Design Algorithms and Data Structures Around a Lack of Fast Integer Division

I had begun scouring my code for optimization opportunities (execution speed, data parallelism, workload parallelism) yesterday when I noticed that there are very few opportunities for speeding up ...
1
vote
1answer
59 views

Using Builtin Method vs Manual Implementation

I work in a DevOps role and mainly write glue code and OS-level automation. I've rarely needed to deviate from existing language implementations or "reinvent the wheel" in the small programs I've ...
8
votes
7answers
558 views

Best algorithm to sort tasks by priorities by a human

I have developed a task management tool. And some task lists can be very large. (I have myself more than 300 tasks to do). I would like to do some task reviews from time to time as the tasks pile up ...
-1
votes
1answer
45 views

Algorithm for subjective ranking by many people

My friends and I are trying to figure out which one of our professor's would win in a fist fight. (ie, 2 profs would fight at a time, and the victors of those fights would then fight, etc. until there ...
-2
votes
1answer
43 views

Shopping Cart Offers

I have been wondering about this issue for quiet some time now. I find interesting and I have not been able to come up with a solution. This must be seen in a context of a shopping cart where you can ...
-4
votes
1answer
77 views

Is there any formula or trick to count how many times a statement inside a nested loop gets executed?

I am modifying a software which is for trash collection. While reading the code, I asked myself is there any formula or trick to quickly calculate the number of time the statement gets executed inside ...
1
vote
2answers
192 views

What is the right algorithm to match regex on a stream?

I'd like to match a regex pattern on a stream, but I am not sure what algorithm to use. I certainly don't want to load the entire file into memory. I tried to figure out how to do this, but I have ...
0
votes
1answer
58 views

Transitive matching in streaming application

Problem A streaming application should perform matching transitively i.e. if A == B & B == C then A == C Current Implementation Application accepts domain objects in a streaming fashion and ...
0
votes
1answer
65 views

Booking problem

The initial task was to find very quickly, free time for resources, let say - hotel rooms, services availability. I came with following model: Let say we have 24h in 1 day, and 365(366) days in a ...
0
votes
3answers
193 views

Comparing whether two very large text contents are different or not efficiently

I have a MySQL database with a column Body MEDIUMTEXT. Until now I used to only store the contents into it. There was no update option for the users of the application. Now, I wanted to add an update ...
0
votes
0answers
64 views

How can i implement two way asymmetric encryption for my app and backend server?

I'm planning to setup a hybrid encryption procedure in my app. So basically i did encryption for data send from client to server using this method, now i'm confused on how to encrypt data send from ...
0
votes
0answers
47 views

Tree Comparison Algorithm

I am looking for an algorithm to compare two trees. I have this class in Java public class TreeNodeDSP { TreeNodeDSP parent; List<TreeNodeDSP> children; NodeDSP value; public ...
-2
votes
1answer
67 views

Smooth out requests to rate limitted API

wasted requests not enough time for those requests | | | | (1) |-x--x-----------------x----x--x--x| x x (executing ...
1
vote
1answer
215 views

Inefficient Pseudocode

I have problems to write my first simple pseudocode. The input of the algorithm is an ontology which contains axioms and an inference set, exactly an inference is defined as an object with set of ...
2
votes
0answers
79 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
49 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
144 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 ...
3
votes
3answers
162 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
37 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 ...
2
votes
1answer
52 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
102 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
46 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
176 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
213 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
57 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 ...
0
votes
1answer
36 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
99 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
888 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
65 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
42 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
21 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
134 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
101 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
83 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
2 3 4 5
42