dzorz | 13 years ago | on: Android X server
dzorz's comments
dzorz | 13 years ago | on: Show HN: Online C/C++ to assembly visualizer [Weekend Project]
root:censored
We can still read /etc/ssh/ssh_host_rsa_key, etc.Edit: removed hash, sorry
dzorz | 14 years ago | on: Why artificially limit your code to C?
dzorz | 14 years ago | on: 500px Terms of Service
Is that Gb or GB?
dzorz | 14 years ago | on: Your problem with Vim is that you don't grok vi
dzorz | 15 years ago | on: Finding the top K items in a list efficiently
dzorz | 15 years ago | on: Finding the top K items in a list efficiently
dzorz | 15 years ago | on: Finding the top K items in a list efficiently
The complexity of nth_element is O(N).
#include <algorithm>
#include <vector>
#include <iostream>
#include <iterator>
using namespace std;
int main() {
int K;
cin >> K;
vector<int> numbers((istream_iterator<int>(cin)),
istream_iterator<int>());
nth_element(numbers.begin(), numbers.begin() + K, numbers.end(),
greater<int>());
for (int i = 0; i < K; ++i) {
cout << numbers[i] << ' ';
}
cout << '\n';
}
Input: 5
1 9 1 3 7 8 2 11 2 5 5 9 1 7
Output: 7 9 9 11 8
Note: the output is not sorted.dzorz | 15 years ago | on: Google paper comparing performance of C++, Java, Scala, and Go [PDF]
Using https://github.com/Rip-Rip/clang_complete you can use smart context-aware completion with vim/emacs.
For example if you had this code:
vector<string> vec; for (auto &x : vec) { x
and then if you typed period (.), it would show members from std::string. I'd say it works better than Intellisense (it's very precise and you use the same parser for code completion and final compilation).
dzorz | 15 years ago | on: Google paper comparing performance of C++, Java, Scala, and Go [PDF]
for (auto &x : vec) { }
dzorz | 15 years ago | on: N-Queen Problem: Python 2.6.5 vs PyPy 1.5.0
==== solution 1 =====
(0, 2, 5, 7, 9, 4, 8, 1, 3, 6)
terminate called after throwing an instance of '__shedskin__::TypeError*'
Aborteddzorz | 15 years ago | on: N-Queen Problem: Python 2.6.5 vs PyPy 1.5.0
dzorz | 15 years ago | on: N-Queen Problem: Python 2.6.5 vs PyPy 1.5.0
dzorz | 15 years ago | on: N-Queen Problem: Python 2.6.5 vs PyPy 1.5.0
dzorz | 15 years ago | on: The Dark Side of C++ (2007)
dzorz | 15 years ago | on: The Dark Side of C++ (2007)
dzorz | 15 years ago | on: Fired employee wipes out whole season of TV show
dzorz | 15 years ago | on: Foursquare 3.0 Has Arrived: Here's What's New
dzorz | 15 years ago | on: C++ in Coders at Work
dzorz | 15 years ago | on: ACM considered harmful