What is O(1) space complexity?

To answer your question, if you have a traversal algorithm for traversing the list which allocate a single pointer to do so, the traversal algorithms is considered to be of O(1) space complexity. Additionally, let’s say that traversal algorithm needs not 1 but 1000 pointers, the space complexity is still considered to be O(1). However, … Read more

Elasticsearch: Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Vivek’s answer is correct, however, the setting will only last for the duration of the session. If the host reboots, the setting will be reset to the original value. If you want to set this permanently, you need to edit /etc/sysctl.conf and set vm.max_map_count to 262144. When the host reboots, you can verify that the setting is still correct … Read more

NumPy List Comprehension Syntax

First, you should not be using NumPy arrays as lists of lists. Second, let’s forget about NumPy; your listcomp doesn’t make any sense in the first place, even for lists of lists. In the inner comprehension, for i in X is going to iterate over the rows in X. Those rows aren’t numbers, they’re lists (or, in … Read more

What’s the difference between facet_wrap() and facet_grid() in ggplot2?

The answer below refers to the case when you have 2 arguments in facet_grid() or facet_wrap(). facet_grid(x ~ y) will display x*y plots even if some plots are empty. Ex: There are 4 distinct cyl and 7 distinct class values. The above displays 4 * 7 = 28 plots, even if some are empty (because some classes do not have corresponding … Read more

Categories R

ReactJS giving error Uncaught TypeError: Super expression must either be null or a function, not undefined

Class Names Firstly, if you’re certain that you’re extending from the correctly named class, e.g. React.Component, not React.component or React.createComponent, you may need to upgrade your React version. See answers below for more information on the classes to extend from. Upgrade React React has only supported ES6-style classes since version 0.13.0 (see their official blog post … Read more