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.

learn more… | top users | synonyms (1)

3
votes
1answer
67 views

Tournament bracket algorithm

I am looking for algorithms to make single elimination and double elimination brackets. The first step was figuring out the seeding algorithm, byes included, which I found in several places in SO: ...
-5
votes
0answers
48 views

Room Allocation Algorithm

I have a challenging problem - I am trying to create some code for room allocation. Here is a possible scenario - I have the following: RoomType | No of Rooms | Max Adults A | 1 | 1 ...
0
votes
1answer
40 views

What is the best way to summarize a sentiment value for a paragraph of text based on the sentiment value for the sentences within it?

So I am using Stanford CoreNLP in my project. I have data which consists of reviews of products on a forum. I need to be able to assign a sentiment value to a given review. CoreNLP allows you to ...
-1
votes
2answers
119 views

How does cab booking service select the nearest driver coordinates?

I understand Uber(or any other cab service) server receives the user coordinates through app. say I book the cab at 10 am. But how does uber know which cabs which is vacant and nearest to user ...
0
votes
1answer
75 views

Merging algorithm for overlapping intervals

I have been searching for an efficient algorithm to merge overlapping intervals on a dynamic array of intervals. For example, (start time, end time) wise, [(1, 2), (4, 8), (3, 10)] becomes [(1, 2)...
1
vote
1answer
45 views

Designing a mechanism to synchronize states with commands despite timing / network inconsistencies

I have two browser clients: A and B. They communicate through a signalling server Server. A has a clientside heartbeat that signals its ClientState to other clients. ClientState can be one of the ...
1
vote
1answer
58 views

Help with algorithm to find optimal route between various routes, where order matters

This seems to be a variation on the Travelling Salesman problem, and I started (as far as some reading at least) going down that route to solve it, but the ordering restrictions are confusing me a ...
-3
votes
1answer
56 views

Create Equation from Table of Values

I created a table of values that return time t in seconds, given an ambient temperature. If one were to plot these values, it might look similar to a quadratic or log. I could just use the look up ...
0
votes
0answers
31 views

Monte Carlo Tree Search in connect 5 tree design

I'm trying to create a mcts AI for connect 5 algorithm. However, I'm confused on designing the tree. Here is a quick description of the algorithm: The initial state, S0 is the board state where the ...
-5
votes
1answer
62 views

Writing a Binary Search algorithm for finding location of value

I'm really only looking for pseudo code here. I'm trying to write a binary search algo which finds the location of a value in a series of values (or the location of where a value should be in a ...
0
votes
1answer
44 views

Add related record on record creation

My question is at a high risk of being a duplicated one, but that is not for lack of investigation. I've been around with this issue for long, and found nothing to solve it, but it seems such an ...
1
vote
1answer
116 views

Monte Carlo Tree Search in Game AI

I am very confused in implementing MCTS for a connect 5 game. According to Wikipedia: Selection: start from root R and select successive child nodes down to a leaf node L. Lets say it's the AI's ...
2
votes
1answer
62 views

Key indicators/determinants that an algorithm has a time complexity of factorial or exponential?

There seems to be significant amount of deep information on the lesser time complexities: linear, polynomial, logarithmic; But there isn't a good source of deep information on how to easily determine ...
4
votes
0answers
92 views

Some “intent”-related questions vis-à-vis Operational Transformation and CRDTs

I’m a little unclear on some questions relating to the "intent" part of concurrent collaboration algorithms (operational transformation and conflict-free replicated data types). Please help! Strings ...
0
votes
1answer
67 views

Lower bound for finding a value in sorted array

Suppose we have a sorted array of unique elements, A[n]. I am trying to find the lower bound for finding a specific element x in the array. I suspect the lower bound to be log_2(n+1). I tried to use ...
2
votes
5answers
318 views

Fastest algorithm of dividing array into positive and negative numbers

Given array of integers I am trying to design the fastest algorithm that swaps the elements such that at the end : all negative elements are on the left and then the positive elements, for example, ...
8
votes
7answers
626 views

What kind of algorithm requires a set?

On my first programming courses I was told I should use a set whenever I need to do things like remove duplicates of something. E.g.: to remove all duplicates from a vector, iterate through said ...
0
votes
0answers
56 views

Invariant of Insertion sort

I am trying to prove the invariant of the inner while of Insertion sort here is the code: for i = 1 to length(A) x = A[i] j = i - 1 while j >= 0 and A[j] > x A[j+1] ← A[j]...
0
votes
0answers
37 views

How can I implement an algorithm to choose cucumber step definition

From past few days I a working with sphinx for implementing the voice recognition feature. So far I have tasted good success in the same. Just wanted to know how can I implement an algorithm for ...
4
votes
2answers
437 views

What is the space complexity for inserting a list of words into a Trie data structure?

There is a quite a bit of information about the time complexity of inserting words into a Trie data structure, but not a whole lot about the space complexity. I believe the space complexity is O(n**m)...
0
votes
1answer
116 views

Is there any planning algorithm that allows scheduling n-sets of events?

The problem is a kind of scheduling problem, I would like to identify what kind of problem this is or, at least, what kind of problems it relates to? Let's say we have n sets of events S1,S2,...,Sn, ...
0
votes
0answers
61 views

Simplifying the Byte Pair Encoding statistics update

Byte Pair Encoding is a multi-pass compression algorithm and at each pass it outputs a rule to merge two individual bytes (for details, see this and this). In this Python implementation from @...
4
votes
3answers
118 views

Finding difference in a big live (almost identical) databases

I have a replicated database (not SQL, a triple store, but specifics should not matter too much) running on several hosts. Each of them holds a copy of the database which is updated by feeding from ...
0
votes
2answers
71 views

Disk file structure for large string list with fast reads by index

I have large list of strings. Each string is of different length, just like sentence in text. Average length is below 255 chars. Please, propose file structure on disk to enable fast picking of random ...
1
vote
3answers
283 views

Why did the C++ std library have a binary search tree well before a hashmap which is in many ways simpler

Looking at the two data structures and algorithms to handle them, a hashmap is not really any more complicated than a binary search tree and possibly less complicated. And the hashmap has the ...
6
votes
2answers
1k views

Can “sub-linear” still be a straight line?

I'm working on a problem that requires a "sub-linear" solution. A quick search for sub-linear will return a lot of this... ... where the sub-linear line is modelled as logarithmic/asymptotic. But I ...
1
vote
2answers
205 views

Loop invariant of Selection Sort

Selection Sort(A[1,2..n]:array of integers) 1.for i=1 to n-1 2.for j=i+1 to n 3.if A[j]<A[i] 4 swap(A[i],A[j]) I am trying to prove the correctness of this algorithm,I read from my book ...
11
votes
4answers
469 views

What are the considerations to determine whether you can use recursion to solve a problem?

Sometimes in interviews, I may use recursion to solve a problem (such as adding 1 to an infinite precision integer), or when the problem presents itself suitable to use recursion. Sometimes, it might ...
0
votes
1answer
124 views

Traveling Salesman-esque: Adding a city to already solved tour?

I am familiar with the Traveling Salesman Problem, and many of the various approaches to solving it. But is there a name for the following problem: Given an existing (solved) tour and a new city, ...
0
votes
1answer
77 views

Scheduling notifications reminders for users

I am trying to design the best way to send reminders to users for events they are registered for: reminders should be sent 72, 48 and 24 hours before the event reminders cannot be sent twice (so user ...
-1
votes
1answer
117 views

Modelling research paper data in JSON

I need to design an UI to edit a research paper, I don't have enough knowledge about the research domain but still I tried to do my best and thought to design a normalized schema. I am describing the ...
3
votes
3answers
101 views

How to search up and down a graph from central point?

I have a set of nodes arranged like the below image. Left columns are parents, right columns are children. A line denotes ancestor/descendant. When I select a node, I want to find the immediate ...
3
votes
3answers
105 views

Search for similar vectors, based on elementwise difference

I understand that there is a thread discussing a similar issue here: How to efficiently search a set of vectors for a vector which is the closest match But my problem is slightly different - and ...
-1
votes
2answers
76 views

Permutations for time in JSON

Let's say that I have a JSON file like at example below. How would I go about finding all possible values of item combination time sums that exist between let's say 00:03:04 to 00:25:55 without ...
2
votes
5answers
180 views

Algorithm to limit the speed of processing items

I need to process a large number of data items, and I need to restrict the speed at which they are processed. For example, not more than 20 items per minute. I've thought about an algorithm for that, ...
6
votes
2answers
316 views

Detecting plagiarism – what algorithm?

I'm currently writing a program to read a body of text and compare it to search-engine results (from searching for substrings of the given text), with the goal of detecting plagiarism in, for example, ...
2
votes
1answer
86 views

I need to find a set of hierarchical symbols that can represent input binary data in near optimal space. What algorithms can I look into? [closed]

I have a stream of binary data. Assume no prior knowledge about the expected pattern in input data. The symbols can represent binary data or other symbols, hence hierarchical. The output should ...
3
votes
1answer
105 views

Approach to perform a calculation over a large dataset and calculate mean of scores

I have a table/collection called scores and it has 3 relevant identifiers based on which calculation need to be done. sample { score : Number, company : String, zone : String, unit : String, ...
5
votes
1answer
88 views

What is the fastest algorithm to find what point of Type 1 is closest for each point of Type 2 on a rectangular grid?

In my contrived example, I have a rectangular grid of nodes, where each node is either empty, of Type 1 or of Type 2. All nodes are directed to the eight nodes around them (horizontal, vertical, ...
4
votes
2answers
251 views

Algorithm to find Minimum bounding rectangle of fixed area [closed]

I have set of spatial points defined by coordinates (x,y) . I want to find the bounding rectangle of given area that maximizes the number of point inside the rectangle. The obtained rectangle should ...
4
votes
1answer
282 views

Scheduling: balanced home/away round-robin tournament algorithm

I am trying to achieve a round-robin algorithm for sports scheduling that also guarantees a fair or balanced home/away rotation. I based my algorithm on the round-robin scheduling algorithm: def ...
2
votes
0answers
72 views

Weighted job scheduling algorithm to minimize load

I have a set of jobs that start by querying an external server for a payload. On receiving the payload, the internal server takes a variable amount of time to complete the job, hence the 'weight'. ...
2
votes
2answers
72 views

Maintain order priority algorithm idea

I am getting huge list and it has two fields as follows: Number Designation 10 Principal 10 Teacher 10 Dean 10 Peon Map map = new HashMap<>(); I am using Map to avoid ...
2
votes
1answer
220 views

Why does the Standard Committee prefer Algorithms to Iterator Facades? [closed]

I was writing a transforming iterator (previously preprocessing iterator), but then I noticed very tight relationship with std::transform(). Then I started wondering if what I'm doing goes "in ...
1
vote
0answers
61 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 ...
1
vote
2answers
104 views

Randomly sorting a list where some states are illegal?

I want to make a randomizer for the items in the game La-Mulana. However, some arrangements of items would mean that the game cannot be completed. Sometimes there's only one group of items required to ...
1
vote
1answer
48 views

Sorting by setting a sequence property instead of rearranging the position in the list

In my project I have a list of items that should be sorted, but instead of re-arranging the positions of the items in the array I want to set a 'Sequence' property defining the item's places in the ...
2
votes
1answer
52 views

How do I implement a run-only-once method when all criteria are met for the first time run it?

I need a run-only-once method that when all the criteria are met, say A&B&C are true, run the codes once, but only once. So if later on all the criteria are met again (A&B&C are true ...
0
votes
1answer
34 views

How is the problem NOVICE43 on Sphere Online Judge(SPOJ) related to Bell Numbers?

Problem Statement : When I first learned backtracking I made a program to find all the permutations of the English alphabets in lexicographically increasing. Filled with elation I showed the ...
3
votes
2answers
265 views

Insertion sort vs Merge sort - memory access

I am a computer science sophomore doing a data structures and algorithms course. My professor said that insertion sort requires random access, while merge sort does not. According to him, the ...