The code below shows a data structure in leetcode. We can see the node1 store a list with node2 and node3, node2 will store a list with node1 and node4. In this case I think node1 and node2 will store the object of each others, which will cause an infinite recursion. How does java store the data structure like this, doesn't it cause a memory exceed? class Node {     public int val;     public List&lt;Node&gt; neighbors;      public Node() {         val = 0;         neighbors = new ArrayList&lt;Node&gt;();     }      public Node(int _val) {         val = _val;         neighbors = new ArrayList&lt;Node&gt;();     }      public Node(int _val, ArrayList&lt;Node&gt; _neighbors) {         val = _val;         neighbors = _neighbors;     } }  public static void main(String[] args) {         Node node1 = new Node(1, new ArrayList&lt;&gt;());         Node node2 = new Node(2, new ArrayList&lt;&gt;());         Node node3 = new Node(3, new ArrayList&lt;&gt;());         Node node4 = new Node(4, new ArrayList&lt;&gt;());          node1.neighbors.add(node2);         node1.neighbors.add(node4);          node2.neighbors.add(node1);         node2.neighbors.add(node3);          node3.neighbors.add(node2);         node3.neighbors.add(node4);          node4.neighbors.add(node1);         node4.neighbors.add(node3);          Solution solution = new Solution();         solution.cloneGraph(node1);     }
I always thought Java uses pass-by-reference. However, I've seen a couple of blog posts (for example, ) that claim that it isn't (the blog post says that Java uses pass-by-value). I don't think I understand the distinction they're making. What is the explanation?
For every set $A$, the empty set is a subset of $A$. The empty set is a set. Therefore, the empty set has a cardinality $\geq 1\ldots$ I have only recently been exposed to sets. According to , as seen on the first bullet mark of the link, $ \forall A: \emptyset \subseteq A$  Does this mean that $\emptyset$ is an element of all sets? (This is False, thank you those that answered)  Is the empty set also a set itself?  Assuming these statements are true, then the empty set therefore an element of the empty set. This does not sound right, please clarify for me. Thank you. Ruby Style: How to check whether a nested hash element exists Page layout assignments with XML metadata API How do I define page layout assignments for different record types via metadata XML files? I am looking to identify a story that I read around 2001 (it is probably much older).  Someone showed me the story on pages printed from the internet, and it was attributed to Isaac Asimov (although I cannot state that is the true author).    The story is told in glimpses at different points of time in the future.  In each glimpse, humans are asking a more and more "intelligent" computer how to prevent the universe from collapsing into a singularity in the future, and the computer states it needs more computational power and resources to solve this problem.  At some point, man becomes one with the computer, and the computer exists in hyperspace (or subspace?).    In the final glimpse, it is the end of time and the universe is collapsing into a singularity.  At the instant the universe reaches the singularity, the computer figures out how to prevent it and says "Let there be light" and the universe begins to expand again.  Is anyone familiar with this story? How can I efficiently generate a Set from a List structure? I have a bit of code where I've written a SOQL query that returns a list of SObject records, however I need a Set&lt;Id&gt; structure to pass to another method that I don't have control of (and thus can't change the method signature of).  How can I turn my returned List&lt;SObject&gt; into a Set&lt;Id&gt;? Is the best option just a for loop? In linear regression, when is it appropriate to use the log of an independent variable instead of the actual values? Let $p$ be a prime number, and let $\mathbb{F}_p$ be the field with $p$ elements. How many elements of $\mathbb{F}_p$ have cube roots in $\mathbb{F}_p$?   I had this question on an exam and after reviewing I am still not sure. Any help would be appreciated. Identifying a thin, black, worm-like creature with a hammer-shaped head I came across the creature shown in the photo below yesterday evening while walking the dogs. At first, I thought it was an earthworm, but a flashlight revealed it to be something I had never seen before.    It is approximately 12 inches (300 mm) in length and about 1/3 of an inch (10 mm) in diameter at its maximum. It is pitch black and very shiny—like piano black. It moves very slowly, using a snake-like motion. It had a very strange head, like a hammerhead shark.  I live in Durban, South Africa, if that helps to narrow down the possibilities.  Can anyone help in identifying this creature? Cannot determine size of graphic Why does the following code in C work?  const char* str = NULL; str = "test"; str = "test2";   Since str is a pointer to a constant character, why are we allowed to assign it different string literals?  Further, how can we protect str from being modified?  It seems like this could be a problem if, for example, we later assigned str to a longer string which ended up writing over another portion of memory.  I should add that in my test, I printed out the memory address of str before and after each of my assignments and it never changed.  So, although str is a pointer to a const char, the memory is actually being modified.  I wondered if perhaps this is a legacy issue with C? I have recently a purchased Lenovo Thinkpad E480 laptop, I have installed Ubuntu 18.04 on it, everything is working fine except am not able to connect to network via WiFi. Please help.  I followed this , but am unable to solve the issue.  Below are the outputs of some commands.  lsb_release -a  No LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 18.04.1 LTS Release:    18.04 Codename:   bionic   uname -r  4.15.0-33-generic   rfkill list all  0: tpacpi_bluetooth_sw: Bluetooth     Soft blocked: no     Hard blocked: no 1: hci0: Bluetooth     Soft blocked: no     Hard blocked: no   lspci -nnk | grep 0280 -A3  05:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter [10ec:c821]     Subsystem: Lenovo RTL8821CE 802.11ac PCIe Wireless Network Adapter [17aa:c024] 06:00.0 SD Host controller [0805]: O2 Micro, Inc. SD/MMC Card Reader Controller [1217:8621] (rev 01)     Subsystem: Lenovo SD/MMC Card Reader Controller [17aa:5068]   sudo lshw -C network   *-network                         description: Ethernet interface        product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller        vendor: Realtek Semiconductor Co., Ltd.        physical id: 0        bus info: pci@0000:03:00.0        logical name: enp3s0        version: 10        serial: 8c:16:45:a3:d9:f1        size: 100Mbit/s        capacity: 1Gbit/s        width: 64 bits        clock: 33MHz        capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation        configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168g-3_0.0.1 04/23/13 ip=192.168.2.2 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s        resources: irq:16 ioport:d000(size=256) memory:f1204000-f1204fff memory:f1200000-f1203fff   *-network UNCLAIMED        description: Network controller        product: Realtek Semiconductor Co., Ltd.        vendor: Realtek Semiconductor Co., Ltd.        physical id: 0        bus info: pci@0000:05:00.0        version: 00        width: 64 bits        clock: 33MHz        capabilities: pm msi pciexpress cap_list        configuration: latency=0        resources: ioport:c000(size=256) memory:f1100000-f110ffff   It seems I have to clone, compile and install the required WiFi driver, please guide me which WiFi driver to use and how to install (with steps if possible).  P.S.: Let me know if any further information is needed to solve this issue, I will add the required info (if any) in the question as per the guidance given. I want to have a  video background that will loop on some frames of my presentation. Can anyone help me to do that? Can we please hold the hats? I really like the hats game. But I would love to keep the hats longer then only one winter. I want to leave them in my wardrobe during summer. Last year, I collected some cool hats, and I apparently lost them during summer.  Maybe we could make a system that allows hats to last for about 2 or 3 years, so we don't have to start over each winter. Or even specify per type of hat a number of years they last? Very very rare hats could last for ever.  I asked this, simply because I love hats! :D Default class inheritance access How to configure lightdm to allow manual logins in Ubuntu 14.04 I used to modify /etc/lightdm/lightdm.conf, adding the line greeter-show-manual-login=true, in order to allow login for hidden users and root.  Now I've just installed the new Ubuntu 14.04 and the file lightdm.conf is no longer located in /etc/lightdm. It's in /etc/init and has been totally modified.  How can I force lightdm login screen to show a field to input a login name? Here's my proof in my own words, does it stack up?   Showing $A$ is complete implies $A$ is closed. Let $(x_n)$ be a convergent sequence in $A$. $A$ is complete $\implies (x_n) \to p \in A$. Hence $A$ is closed. Showing $A$ is closed $\implies$ $A$ is complete. Let $(x_n)$ be a convergent sequence in $A$. $A$ is closed $\implies (x_n) \to p \in A$. As every convergent sequence is a Cauchy sequence, $(x_n)$ is a Cauchy sequence in $A$ that converges to $p \in A$ and hence $A$ is complete.   That sound ok?  As an aside, it seems to me that the definition of completeness and closed are basically identical, why are there two definitions for the same thing? Am I missing something here? Purpose of memory alignment Admittedly I don't get it. Say you have a memory with a memory word of length of 1 byte. Why can't you access a 4 byte long variable in a single memory access on an unaligned address(i.e. not divisible by 4), as it's the case with aligned addresses? Why has it become an industry standard for logos to redirect a user to a website's homepage?   Where was this first seen? Does a Vietnamese citizen need a transit visa for South Korea? I am a Vietnamese passport holder. I'm going back to Viet Nam from Montreal this December, and I will transit at Incheon Airport for a few hours. Do I need a Korean visa just for transiting, either from Montreal to Hanoi or from Hanoi back to Montreal? I remember a story I have read buy could not remember the author the name or anything apart from the basic plot. The story is about some future where humanity has to fight with some aliens (not 100% sure). The story tells about a guy who was some kind of activist and who was in a prison two or more times and somehow helped humanity by being held in a prison (can't remember details). I think the story starts by saying that there is a statue in his honor that is not very well known but he did more to help humanity than famous politicians.   The story is most likely written by some famous English-speaking author, though I read it in a translation.