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
-3
votes
0answers
8 views

What are some good 'mini-project' ideas/problems that I can implement a solution for using Data Structures and/or Algorithms?

Some details: The level of this project has to be of a typical semester project; I'm doing this in my 3rd semester for 2 credits. I'm not clueless with DS&A, but I'm no pro (yet, hopefully one day ...
-3
votes
0answers
17 views

Better way to process huge files

I have a huge csv file and I have to process that file and do some data manipulation. Right now I'm reading/loading the file in buffer and then doing the data processing work. I find this approach ...
-5
votes
0answers
63 views

How does Backtracking work in this Sudoku solver? How is the next “path” chosen

I have this solve function. From my understanding the backtracking part of this algorithm is the line after the recursive solve(). I would think that it would leave 0's in the final board. Say if I ...
-4
votes
0answers
29 views

What would bea good algorithim for calling multipl APIs?

I have an object where I have one method API call on, it is a get request and I have a library I imported in python so I can easily call this API from my client. I am now trying to call another API ...
-2
votes
2answers
186 views

Is looping an array to compare to itself considered O(n^2)? [duplicate]

Often when I'm doing an operation comparing an array to itself, I write code along these lines: function operation (array) { for (let i = 0; i < array.length; i++) { for (let j = i + 1; j <...
4
votes
2answers
139 views

How to show fluctuating data smoothly and accurately?

I am working on a project in which I have to read data from liquid level sensor installed in tank which measures fluid level and sends output in millivolt. The device has predefined ranges of voltage ...
1
vote
3answers
210 views

Need help finding an efficient way to group the keys in a dictionary into buckets defined by the values in the dictionary?

I have a dictionary in the form of Dictionary<int, List<int>> The problem is that I need to group the keys together into buckets defined by the value (List<int>). It is easier to ...
-4
votes
1answer
55 views

What is the largest acceptable Big-O value for an algorithm used in a large distributed system? [closed]

Say you're working on a very large dataset that can't fit on a single machine (aka actual big data). What is the largest x in your O(x) algorithm that would be reasonably usable in this kind of ...
0
votes
0answers
63 views

Which algorithm can I use to partition sports teams based on their time constraints?

I am writing an application for tournament organizers. These tournaments have games that last 1h. Usually an organizer has access to the infrastructure for certain time slots in the week, e.g. only on ...
3
votes
5answers
224 views

Applying function to file line by line or read entirely into structure first?

I've often found myself with the need to develop tools that process large files over a network and perform an operation to every element in that file. An element may be an individual line or an object ...
-3
votes
2answers
82 views

Which hash algorithm is best for speed and identical hashes. (a lot of collisions)

I'm searching an existing hash function or trying to make a hash function that has a lot of collisions. Regularly a hash is used for it's ability to create unique hashes for hash tables or security ...
1
vote
0answers
58 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
37 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
146 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 ...
3
votes
1answer
116 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 ...
3
votes
5answers
249 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
61 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
129 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
178 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
79 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
113 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
37 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
34 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
68 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
576 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
44 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
78 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
193 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
60 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
195 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
82 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
146 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
163 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
38 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
54 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
104 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
47 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
178 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 ...

1
2 3 4 5
42