-53 karma · joined Apr 15, 2011 (15y ago) · 51 submissions
comment 15y ago · link · parent
You know what actually makes a difference in life? Acquire knowledge, apply that knowledge, make connections and use all of that to HELP other people and change the world. Tripping on shrooms by yourself or with your fellow dunderheads does nothing for anyone, yourself included. Stop pretending it does.
comment 15y ago · link · parent
I've read O'Reilly's Collective Intelligence. It's a great introductory survey, but it was very light on theory.
I also own Collective Intelligence in Action. It had more explanation of theory than O'Reilly's offering, but most of the chapters devolved into how to use Java data mining framework X.
comment 15y ago · link · parent
Statistics and linear algebra really should be required by all CS programs. It's funny that at many schools those courses are not, yet Calculus is. First, Calculus should have been handled in HS. Second, I've never had a use for Calculus professionally or for anything I've worked on in my free time.
comment 15y ago · link · parent
public List<Integer> mergeSort(List<Integer> list) { // Base case // If list has one (or less) element, return list as is int size = list.size(); if (size <= 1) { return list; }
// Partition list in half
int m = size / 2;
List<Integer> left = new ArrayList<Integer>();
List<Integer> right = new ArrayList<Integer>();
for (int i = 0; i < m; i++) {
left.add(list.get(i));
}
for (int i = m; i < size; i++) {
right.add(list.get(i));
}
// Recursively merge sort each partition
left = mergeSort(left);
right = mergeSort(right);
// If the last element of the left partition is greater than the first element of the right partition
// The left and right partitions need to be rearranged
if (left.get(left.size() - 1) > right.get(0)) {
return merge(left, right);
// Otherwise left and right partitions are in the correct order
} else {
left.addAll(right);
return left;
}
}
protected List<Integer> merge(List<Integer> left, List<Integer> right) {
List<Integer> result = new ArrayList<Integer>();
// While both containers are non-empty
// Move lesser elements to the front of the result, and remove them from their containers
while (!left.isEmpty() && !right.isEmpty()) {
if (left.get(0) < right.get(0)) {
result.add(left.remove(0));
} else {
result.add(right.remove(0));
}
}
// The container that still has elements contains elements greater than those in the other container
// It is assumed that the elements in the container are also already sorted
// So the non-empty container's elements should be appended to the end of the list
if (!left.isEmpty()) {
result.addAll(left);
} else {
result.addAll(right);
}
return result;
}comment 15y ago · link · parent
NodeJS is great for applications with a lot of clients, but not for CPU intensive apps. That's why I predict similar technologies built on Erlang, Scala, and Go will have more longevity than NodeJS.
comment 15y ago · link · parent
comment 15y ago · link · parent
function mergeSort(items){
if (items.length == 1) {
return items;
}
var middle = Math.floor(items.length / 2),
left = items.slice(0, middle),
right = items.slice(middle);
return merge(mergeSort(left), mergeSort(right));
}You don't need to run merge on the left and right partitions every call. You only need to do that if the left partition's last element is greater than the right partition's first element. Otherwise, you can just append the right partition to the left, since they are already in sorted order.
comment 15y ago · link · parent
Hardware (Apple, Amazon) OS (Apple, Google) Cloud services (Google, Amazon, Apple) Web services like email, maps, search (Google)
Facebook has a very large user base. Whoopee. But does that mean staying power? Nope. Just ask Myspace, Yahoo, and countless dot bomb companies. You need to invest in R&D, become a technology provider, and succeed in more than one market. Beyond social networking, what does Facebook have?
This is a horrible article, especially by the Economist's standards.
comment 15y ago · link · parent
I wonder if the author would have said the same thing about Myspace 5 years ago. I bet he would have.