Given two integers a and b, is there an efficient way to test whether there is another integer n such that a ≤ n2 < b?
I do not need to know n, only whether at least one such n exists or not, so I hope to avoid computing square roots of any numbers in the interval.
Although testing whether an individual integer is a perfect square is f...
Dear Folks,
One of my students asked me this kind of homework with C++ arrays. It seemed quite interesting for me, so, though I have solved this problem, I wanted to share my solution with you and know another variants and opinions. The problem is following:
Problem
It is given a 2D dynamic quadratic matrix (array) A(nxn). It is require...
Why is this code note working (the code compiles and run fine, but is not actually showing the permutations):
int main(int argc, char *argv[])
{
long number;
vector<long> interval;
vector<long>::const_iterator it;
cout << "Enter number: ";
cin >> number;
while(number-->0){
interval.push_back(number);
...
Hi,
I am interested in determining the musical key of an audio sample. How would (or could) an algorithm go about trying to approximate the key of a musical audio sample?
Antares Autotune and Melodyne are two pieces of software that do this sort of thing.
Can anyone give a bit of a layman's explanation about how this would work? To ma...
I want to pre-compute some values for each combination in a set of combinations. For example, when choosing 3 numbers from 0 to 12, I'll compute some value for each one:
>>> for n in choose(range(13), 3):
print n, foo(n)
(0, 1, 2) 78
(0, 1, 3) 4
(0, 1, 4) 64
(0, 1, 5) 33
(0, 1, 6) 20
(0, 1, 7) 64
(0, 1, 8) 13
(0, 1, 9) 24
(0, 1, 10...
Hello, I'm implementing a MacOS X's spotlight like universal search for a web based software. So the basic functionality (fetching results, displaying them) is done and it's working perfectly, but now I have to do some more work on giving the user the right results.
Basically I have three important parts in the software
Document ID
Doc...
Hi,need recomendations about www search book in real situations (for example, parameterized fast search in catalogue) with examples.
Thanks.
...
I am reading through the binary tree delete node algorithm used in the book Data Structures and Algorithms: Annotated Reference with Examples
on page 34 , case 4(Delete node which has both right and left sub trees), following algorithm described in the book looks doesn't work, probably I may be wrong could someone help me what I am mis...
Hi everybody,
Everyone knows how to convert number from decimal system to binary. I also do. Everyone also knows how to convert from decimal to the base of three system.
However, I have a problem where I need to convert decimal number to a "strange base 3" system where one symbol cannot be the first one and should be surrounded by the ...
I'm trying to implement mergesort in Coldfusion, but it is spitting out incorrect results, code:
<cffunction name="mergeSort" hint="Sorts arrays of structs">
<cfargument name="arr" type="Array" required="yes">
<cfif Arraylen(arr) LTE 1>
<cfreturn arr />
</cfif>
<cfset left_ = ArrayNew(1)>
<cfset right_ = ArrayNew(1)>
<cfset mid_ = ...
Hi! I learned that Google Map has a Get Direction feature that let users find the shortest path from one point to another. What search algorithm did Google used for this search? Is this algorithm can be implemented in the Android platform, knowing that it has low memory and it's running in Java(tend to be slow)? Thanks in advance!
...
Guys,
Based on this url i found Bayesian Rating, which explains the rating model very well, i wanted to summarize the formula to make it much easier for anyone implementing an SQL statement. Would this be correct if i summarized the formula like this?
avg_num_votes = Sum(votes)/Count(votes) * Count(votes)
avg_rating = sum(votes)/...
I have a set of 18 values (it will always be 18) which I need to distribute into two sets, one of 10 items, and one of 8 items.
The rule for distribution is that the values of each set must be equal (or as close as possible) to a particular known value - so in the first set the sum of the values must be as close as possible to 1500000 ...
I was wondering why the heap concept is implemented as algorithms (make_heap, pop_heap, push_heap, sort_heap) instead of a container. I am especially interested is some one's solution can also explain why set and map are containers instead of similar collections of algorithms (make_set add_set rm_set etc).
...
A common theme I'm seeing in my courses are worst/best case performances for trees, hash tables, equations such as log n. I'm wondering if there's a de facto place where people refer to find this sort of information (textbook, online, etc) besides Wikipedia. I'm hoping to find something that mathematically breaks down such algorithms/dat...
Possible Duplicates:
Is it possible to decrypt md5 hashes?
Is it possible to reverse a sha1?
i asked this question:
http://stackoverflow.com/questions/3143693/working-with-huge-spreadsheet
and got a great answer and i followed the advice. i used this:
http://splinter.com.au/blog/?p=86
and i hashed about 300,000 different e...
Hello,
I have a requirement in my .net project where I need to select an item from a collection, each item has a Weight (integer from 1 to 10) assigned to it. I need a random generator that would take this weight into consideration i.e. the higher the weight, the more chances the object would be selected. Any code samples in .net are ap...
Consider the problem of counting the number of structurally distinct binary search trees:
Given N, find the number of structurally distinct binary search trees containing the values 1 .. N
It's pretty easy to give an algorithm that solves this: fix every possible number in the root, then recursively solve the problem for the left a...
I've got a real problem (it's not homework, you can check my profile). I need to parse data whose formatting is not under my control.
The data look like this:
6,852:6,100,752
So there's first a number made of up to 9 digits, followed by a colon.
Then I know for sure that, after the colon:
there's at least one valid combination of n...
with SHA-1 is it possible to figure out which finite strings will render equal hashes?
...