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
-5
votes
0answers
16 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
19 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 ...
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 ...
-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 <...
-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 ...
50
votes
6answers
46k views

What is a helper? Is it a design pattern? Is it an algorithm?

Maybe a little tongue-in-cheek, but as I can't find this answer anywhere through Google, so to ensure Software Engineering has the answer: What is a helper? I have seen the name being used ...
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 ...
5
votes
3answers
786 views

Find path of steepest descent along with path length in a matrix

Came across this problem -- You are given a grid with numbers that represent the elevation at a particular point. From each box in the grid you can go north, south, east, west - but only if the ...
-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 ...
2
votes
1answer
206 views

Can Mean Shift Algorithm used in color quantization?

I have a problem with deciding algorithm for color quantization. The image that I want to do color quantization is an RGB image with resolution 512 x 512. I want to reduce the color value in the pixel ...
3
votes
2answers
33k views

How to calculate the checksum for Laboratory Information System (LIS) frames?

I am developing instrument driver and I want to know how to calculate checksum for a Laboratory Information System (LIS) frame. Explanation: Expressed by characters [0-9] and [A-F]. Characters ...
25
votes
4answers
8k views

Calendar/Planning algorithm

I'm facing a problem I'm not sure how to approach. I have to generate a calendar for employees, each of them having specific work constraints (some personal, some common) What I'm working with : I ...
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 ...
4
votes
5answers
2k views

Poker split / side pots

I am writing a poker application and trying to figure out how to deal with split pots and side pots There are four rounds of betting and each round of betting can have multiple orbits Can only ...
-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
1answer
287 views

Optimized algorithm to match entities together based on heuristics

I've encountered a problem which I think is rather suited to be solved using a Constraint Satisfaction Problem algorithm. I am however, not entirely certain that this is the best approach, as 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. ...
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 ...
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 ...
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 ...
-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 ...
32
votes
4answers
47k views

Prerequisite math skill for Introduction to Algorithms (CLRS) book [closed]

I already have knowledge about basic algorithms. Now I plan to study more advance algorithms and I decide to go with Introduction to Algorithms. I'm not sure, do I need to refresh my math's skill ...
-1
votes
1answer
252 views

Should an algorithm handle invalid inputs and can it have hard-coded paths for certain input data? [duplicate]

I have certain preconditions on input data and I need to design an algorithm for that data. Should I also handle invalid preconditions? Also is it normal that my algorithm will work only for a ...
51
votes
2answers
58k views

How would you implement Google Search? [closed]

Supposed you were asked in an interview "How would you implement Google Search?" How would you answer such a question? There might be resources out there that explain how some pieces in Google are ...
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
3answers
169 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 ...
2
votes
1answer
121 views

Proof of digital document integrity

Let's say we have the following scenario. We have user A and user B and an initial digital document D generated by B. What algorithms and infrastructure are required in order to guarantee/prove ...
0
votes
1answer
73 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 ...
-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
682 views

Algorithm for windowed online covariance

I'm trying to adapt an algorithm to calculate covariance to work over a rolling window on the data. Wikipedia has an algorithm for online covariance: def online_covariance(data1, data2): mean1 = ...
3
votes
1answer
168 views

Spreading objects in bags and bags' compartments

We have 10 bags. Each bag has 5 compartments numbered from 1 to 5. We have 100 objects to fill all the compartments and bags. Compartment number x in a bag is identical to compartment of the same ...
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 ...
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 ...
-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 ...
0
votes
9answers
9k views

When calculating how many days between 2 dates, should you include both dates in the count, or neither, or 1?

I am trying to make an algorithm that counts the days between two dates, e.g. between 3/1/2012 and 3/2/2012. What is the correct answer, or the most popular choice? Should be the one I use? In ...
7
votes
1answer
388 views

data structure/algorithm for conditional next step

I have been trying to find a proper way to represent the above data flow (this is just a small case), and I'm not sure if I found a good way to do it. Our current implementation just evaluate all the ...
1
vote
0answers
68 views

Decision tree for storing subscription info

I have a system in which user creates an entity. Now this entity has attributes which are dependent on many external systems. We have all those pipelines in backend which updates these entities when ...
-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 ...
1
vote
2answers
949 views

How to find matching profiles?

I'm developing backend for a dating app, in which each user has a profile of his/her characteristics a profile of ideal match's characteristics There are dozens of characteristics like gender, ...
-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;...
2
votes
1answer
503 views

Using binary search in different scenarios

I have to give my one of the biggest interviews next week and I am working hard for that. I have also enrolled myself for some mock interviews for that. So, coming to the problem last day I had this ...
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 ...
3
votes
2answers
2k views

Explanation of satellite data from a programmer's perspective

I have started reading Part 2 of Introduction to Algorithms and in the section The structure of the data the author/authors says in the context of sorting a sequence of numbers: In practice, the ...

1
2 3 4 5
42