An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
2
votes
1answer
13 views
Rectangle packing with constraints
I want to pack a set of rectangles (example):
So that the total height is as low as possible with the constraint that the rectangles may only move vertically.
Our current algorithm is to process ...
2
votes
1answer
23 views
Average number of bits required to store one letter of British English using perfect compression in python
I have an assignment which is written under:
What is the average number of bits required to store one letter of British English if perfect
compression is used?
Since the entropy of an experiment can ...
3
votes
1answer
34 views
get the reverse of a function for key producing
I'm tasked with making an online version (for automation purposes) of the app that produces the keys for a software.
each software shows the user an access code (from system volume information) and ...
-2
votes
1answer
49 views
Alternatives to The art of computer programming by donald knuth
The art of computer programming textbook by donald knuth is a wonderful introduction to algorithms but all examples are written in assembly code . I'm not familiar with assembly langauge and I think ...
2
votes
3answers
78 views
Compare two (non-STL) maps for equality
A 3rd-party library we're using is essentially a map/dictionary. It doesn't provide any way of equality testing two objects against each other and we need this.
More specifically, two maps S1 & ...
6
votes
2answers
80 views
Maximum/Minimum of all subarrays/ Windows of size k
Given an Array of Size n , that is it have n elements in it. and window size 'W'. you have to find maximum/minimum in all subarrays of size 'W'. starting from index 0.
Sample Input:
n=10 , W = 3 // n ...
0
votes
1answer
79 views
Function to return count of duplicate numbers in sorted array
I want to return the number of duplicate values in a sorted array.
For example: a = { 1, 1, 2, 3, 4, 4 }, fratelli(n) should return 2. (They are 1, 1 and 4, 4)
I attempted to use a recursive ...
2
votes
1answer
31 views
How do I minimize the amount of memory needed for a fixed allocation scheme?
The following image visualizes the needed life span for 16 memory blocks of various sizes:
What I'm essentially looking for is given a number of N blocks of size sizei and lifetime [begini, endi), ...
-2
votes
0answers
19 views
Drawing Isotherm lines(or contour) using Java given specific points
I want to write a code that takes input image of a map, then mark some random points (suppose 20 points) in the map and set their temperature. Then I have to draw the isoline. I want to know the ...
2
votes
1answer
40 views
Computing the optimal combination
I am designing an application wherein I need to choose from a group of fertilizers, the best possible combination, i.e the minimum amount of fertilizers which can supply the given nutrients.
For ...
1
vote
2answers
30 views
Memory usage of a node class of a LinkedList in java (enclosing instance reference)
In page 201 of Sedgewick's algorithms4 book, the memory taken up by a Node is given as 40 bytes:
class Node{
Item item;
Node next;
}
The breakdown given is:
object overhead = 16 bytes
...
0
votes
2answers
33 views
Grouping products that are the same but have slightly different titles/attributes
I am showcasing a large amount of products to my website.
I have to group similar products from different websites,
which I have already crawled to my DB.
So that when a product is searched, it also ...
10
votes
5answers
136 views
How can I find hole in a 2D matrix?
I know the title seems kind of ambiguous and for this reason I've attached an image which will be helpful to understand the problem clearly. I need to find holes inside the white region. A hole is ...
-1
votes
1answer
56 views
Data-structure to store counts of events occurring over different time periods [closed]
Came across this question on http://www.careercup.com/question?id=6005446611566592
Given a server that has requests coming in. Design a data structure such that you can fetch the count of the number ...
0
votes
1answer
73 views
why kruskal's algorithm and dijkstra's algorithm are so similar to each other? [closed]
I know that these two algorithms are used to solve different problems, dijkstra's algorithm is used to find shortest path in a graph while kruskal's algorithm is used to find the MST of a graph.But ...