Priority queue in .Net

You might like IntervalHeap from the C5 Generic Collection Library. To quote the user guide Class IntervalHeap<T> implements interface IPriorityQueue<T> using an interval heap stored as an array of pairs. The FindMin and FindMax operations, and the indexer’s get-accessor, take time O(1). The DeleteMin, DeleteMax, Add and Update operations, and the indexer’s set-accessor, take time O(log n). In contrast to an ordinary priority queue, an interval heap … Read more

Python strip with \n [duplicate]

You should be able to use line.strip(‘\n’) and line.strip(‘\t’). But these don’t modify the line variable…they just return the string with the \n and \t stripped. So you’ll have to do something like That should work for removing from the start and end. If you have \n and \t in the middle of the string, you need to do to replace the \n and \t with nothingness.

Regex how to match an optional character

Use to make the letter optional. {1} is redundant. (Of course you could also write [A-Z]{0,1} which would mean the same, but that’s what the ? is there for.) You could improve your regex to And, since in most regex dialects, \d is the same as [0-9]: But: do you really need 11 separate capturing groups? And if so, why don’t you capture the … Read more

Error in ggplot.data.frame : Mapping should be created with aes or aes_string

The error (in the title of the post) arises because you have too many arguments to ggplot. As the comments to the question note, the pipeline %>% implicitly includes the output from the left-hand side of the pipe as the first argument to the function on the righthand side. This code replicates the same kind of error. (I’ve … Read more

Categories R Tags

What is WCF? and what can it do?

@acidzombie24, to counter your comment to Ryan’s answer: WCF is NOT a remote function call – not at all. Quite the contrary! WCF is a message based communication system – your clients will have a proxy that has the same method as the server. When you call such a function on the client proxy, what the WCF runtime does … Read more

What does pythonic mean?

Exploiting the features of the Python language to produce code that is clear, concise and maintainable. Pythonic means code that doesn’t just get the syntax right but that follows the conventions of the Python community and uses the language in the way it is intended to be used. This is maybe easiest to explain by … Read more