Type: Posts; User: laserlight
Search took 0.11 seconds.
November 26th, 2015, 11:55 PM
Not quite: there may be as many insertions as there are objects in the range, but each insertion would normnally take logarithmic time.
November 26th, 2015, 02:02 AM
If you want constant searching time, then binary search over a sorted vector won't cut it: binary search has an average and worst case time complexity of O(log n), not O(1). You would likely either...
November 26th, 2015, 01:18 AM
Post the smallest and simplest compilable program that demonstrates this problem.
November 26th, 2015, 01:16 AM
What does "sort by the bounding boxes" mean? You wrote that you "sort all bounding boxes by X coordinate", so as long as you want to search by X coordinate, binary search can be used on the sorted...
November 26th, 2015, 01:04 AM
#include <algorithm> and use std::binary_search, std::lower_bound or std::upper_bound, depending on your exact requirements.
#include <algorithm> and use std::equal_range.
What do you mean...
November 9th, 2015, 03:29 AM
Hmm... I went to re-read the instructions that you posted in post #1, and it seems that the expected output should be:
[[2, 2, 2, 2, 2], [2, 2, 3, 3], [2, 2, 6], [2, 3, 5], [5, 5]]
or with the...
November 8th, 2015, 10:41 PM
I don't see a list(check) in your code, or any other way that you are making a copy of the list.
What I do see is you adding a check for an empty list, but if you want to do that, I suggest:
November 8th, 2015, 02:32 PM
At the start of the function, make a copy:
check = list(check)
To avoid confusion, I would remove the global variable named check and write:
Coin_Change_Count(N, [0, 0, 0, 0])
November 8th, 2015, 01:19 AM
What is your current code and how exactly does it not work?
November 7th, 2015, 12:17 PM
Hadoop is more Java oriented, methinks. However, your general programming skills would help, and then there apparently are Python frameworks for Hadoop.
November 6th, 2015, 09:23 AM
Surely you have searched the Web and found some information. What have you found out and what would you like to clarify?
November 6th, 2015, 03:46 AM
Take advantage of what your instructor provided as a starting point:
def find(input_string, substring, start, end):
If you check the Python documentation, you will find that...
November 5th, 2015, 01:35 PM
Ah yes, though in general we can find a lot of material there ;)
I think you meant 1998 as the 2003 revision to the standard was relatively minor.
November 5th, 2015, 12:26 PM
That is interesting and makes sense: you eliminate the repeated use of the type name while ensuring that with value-initialisation the default constructor will be invoked for a class type, and if...
November 5th, 2015, 12:13 PM
Have you read the essay by Stroustrup? He certainly does not condemn the idea that students should learn to work with pointers, and in fact the short extract I posted shows that he does recommend...
November 5th, 2015, 04:22 AM
You might want to read Stroustrup's essay on Learning Standard C++ as a New Language (PDF). He recommends an approach that:
proceeds from the concrete to the abstract,
October 14th, 2015, 02:01 PM
You apparently discovered that "it doesn't work for some certain instances", but for some reason you decided to be so vague as to not mention what those instances are.
Yet, these instances are...
October 12th, 2015, 04:17 AM
As 2kaud explained in word, factor-- as used here is short for:
factor = factor - 1;
You will find out later that there's more to it, but as long as you are using this with the built-in types...
October 12th, 2015, 04:06 AM
Instead of using magic numbers like 8 or 13, you should use named constants, or in this case use the corresponding character literals '\b' and '\r'.
By the way, to use std::string, you should...
October 7th, 2015, 02:19 AM
Read Stroustrup's answer to the FAQ How do I deal with memory leaks? The executive summary: use a std::string or a container like std::vector instead of doing manual memory management.
October 1st, 2015, 04:40 AM
October 1st, 2015, 03:18 AM
Agreed: unless it can be shown to be a mistake in the standard or is an acceptable language/library extension, where a compiler differs from the standard, it is a bug in the compiler.
October 1st, 2015, 02:53 AM
Perhaps you should just write a function to do the job, returning a dstring object.
September 29th, 2015, 02:19 PM
This uses C rather than C++, but you might also want to read this tutorial on skip lists. Incidentally, the tutorial is linked from the skip list entry in the online Dictionary of Algorithms and Data...
September 27th, 2015, 09:11 AM
That does not sound correct to me: your version of the algorithm operates on a container that has a size() member function with operator for random access by 0-based index.
I agree, but then...
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!