how is java8 Streams different than collection in java [closed] - java-8

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
explain the comparison with the example.
can anyone explain to me the line from the book "java8 in Action" ---
every element in the collection has to be computed before it can be
added to the collection.

I like the explanation from the book Java 8 in action, maybe it will help you too understand better the difference:
For readers who like philosophical viewpoints, you can see a stream as a set of values spread out
in time. In contrast, a collection is a set of values spread out in space (here, computer memory),
which all exist at a single point in timeā€”and which you access using an iterator to access
members inside a for-each loop.

Related

What is a most optimal way to merge and sort 2 sets? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 months ago.
Improve this question
So, say you have 2 sets with unknown properties. So the order and the size of each set is unknown. How would we merge and sort these 2 sets into one set?
The solution I have is to simply add the 2 sets into one set and perform a merge sort.
I feel as if there is a better way. Does anyone have any ideas?
Typically you would concatenate the sets and then sort them as a single set, that is almost as simple as it gets. I'm guessing you are using Python for this if that's the case you can use function sorted().

Is it necessary to memorize the codes of data structures? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Is it necessary to memorize the code of data structures like linked lists, dynamic arrays , circular linked list, queues , stacks , Graphs etc. Or just the basic knowledge of code is enough ? What kind of questions can be asked in a job interview regarding data structures ?
I don't know what your (future) employer may ask, but generally, I'd say no. You have to know how they work and what they're used for, expecially which data structure serves which purpose with its advantages/disadvantages. If you know that, you'll be able to write the code of such a structure without having it memorized - because you know how it will work.

Searching through an list [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm reading about AI and in the notes it is mentioned
A lookup table in chess would have roughly 35^100 entries.
But what does this mean? Is there any way we could find out how long it would take the computer to search through and find it's entry? Would we assume thereis some order or that there is no order?
The number of atoms in the known universe is estimated to be around 10^80 which is much less than 35^100. With current technology, at least a few thousand atoms are required to store a single bit. I assume that each entry of your table would have multiple bits. You would need some really advanced technology to implement the memory of your computer.
So the answer is: With current technology it is not a matter of time, it is simply impossible.

Which data structure will always run half the size of an array when implemented recursively? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I had this question on my exam today.
Choices were: 1)Merge sort 2)Quick sort 3)insertion sort 4)bubble sort 5)selection sort
I had a feeling that the answer is either 1 or 2, but I don't know which one it is. It seems merge sort and quick sort wouldn't stop at the middle. Can someone explain the reason of the answer you pick?
The merge sort is called with (i.e. sorts) half the data on each recursive call. The data need not be duplicated, however.

How to calculate the relevance of two words or pharse? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need a algorithm to calculate and measure the relevance of two words or phrase, e.g. "Apple" and "iPad".
Can anybody give me some hints or related books on such topics?
Thanks.
Have a look at mutual information and tf-idf. These are methods that are frequently used in information retrieval. The former quantifies the mutual dependence of two variables (each variable can be a phrase). The latter was traditionally used by search engines to prioritize results that were relevant to a particular query.

Resources