Skip to main content

All Questions

Tagged with
1 vote
1 answer
195 views

How do I narrow down a search space if symmetries are equivalent?

I have an algorithm that runs a search through every combination of a 5x5 grid where each cell can have 3 values, looking to see which combinations meet certain conditions. This gives 3^25 naive ...
Jason C's user avatar
  • 465
0 votes
3 answers
754 views

Why isn't a counter used to avoid nested for loops for index based operations?

Let's assume we have a method that we want to run as fast as possible and it needs to loop on a 2D array, naturally we would do a nested for loop as such: int[][] arr = new int[3][3]; for(int ...
Yoh's user avatar
  • 51
2 votes
1 answer
2k views

Multiple if condition optimization

Often I find conditional statements such as: if (life_max < max): if (expand): do life_max = max else: if (life_max > max) and not (expand): do life_max = max; Although readable, ...
Chibueze Opata's user avatar
5 votes
4 answers
641 views

Processing a 2D matrix - need to speed up my O(n^4) algorithm

I have an n x n matrix which I need to convert into a list sorted by value. Starting with the maximum value cell at (row x1, col y1), I must immediately exclude all cells where (x >= x1, y <= y1)...
Irfan434's user avatar
  • 187
21 votes
6 answers
5k views

Using a different algorithm depending on the size of the input

I recently finished a course on advanced algorithms, and another on complexity & computability theory, and in the past few days my mind has been somewhat preoccupied by this question. Why don't we ...
cliesens's user avatar
  • 345
-3 votes
2 answers
1k 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 ...
NS - Not the train's user avatar
5 votes
5 answers
1k 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 ...
Jimbotron's user avatar
0 votes
1 answer
108 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 ...
Alexandr's user avatar
  • 101
0 votes
1 answer
294 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 ...
dan1st's user avatar
  • 111
2 votes
1 answer
117 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 ...
Varinder Singh's user avatar
0 votes
1 answer
169 views

How large-scale production web crawlers improve performance when it comes to running into already visited links

I have built a very basic webcrawler running off my laptop so it has limited memory and limited hard drive space. The way I have it now is I'm using MongoDB to store the links I find on pages. I make ...
Lokasa Mawati's user avatar
1 vote
1 answer
87 views

Calculation On Large File Data

I have a task where I need to read a big data file and process the data in it. Every row in the file looks like this: CustomerId ItemId Amount Price I need to calculate the total cost for the ...
Mojo's user avatar
  • 171
-2 votes
1 answer
2k views

Is algorithm performance dependent on the programming language used? [closed]

I have studied complexity of algorithms that how long an algorithm will take to execute completely, then why it is said that certain programming languages are faster than others such as C++ is faster ...
Asad Ullah's user avatar
0 votes
1 answer
41 views

Assembling random indexed packages into an ordered sequence(s)?

I am pretty confident that this is well-known and solved problem. Suppose there are n uniquely indexed "packages" randomly getting into single entry point like .AcceptPackage(Package package). ...
Zazaeil's user avatar
  • 345
1 vote
1 answer
167 views

What tools exist to determine the speed up a GPU will have on an algorithm?

Basically, I am wondering what sort of speed I will get by parallelizing a algorithm to work with GPUs. I am wondering if someone has implemented queueing theory/Amdahl's law with a UI or if everyone ...
Robert Baron's user avatar
  • 1,132

15 30 50 per page
1
2 3 4 5