Divide the amount of waters in to containers [closed] - algorithm

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 days ago.
Improve this question
Let 𝑛 > 1 identical containers, one of them with 𝑊 liters of water and the rest empty. You are allowed to perform the following action: take two of the containers and divide the total amount of water in them equally between them. The objective is to achieve the minimum possible amount of water in the container containing all the water of the original arrangement by a sequence of the above actions of transferring water from container to container.
What is the best way to do this? How many actions will be required? Can I have an algorithm?

Related

Is there any algorithm to achieve some optimization for hanger placement? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 months ago.
Improve this question
I need to do a job where I need to place a particular object(Hanger) in a standard distance.
The rules are:
We should try to place each object in a given standard distance from each other.
There is a max distance from one object to adjacent object which in no way should be violated.
From the start and end also similar standard and maximum distance rule applies.
And there are some portions given where the objects placement needs to be avoided.
I'm not even able to start... which algorithm to use.
If anyone has any suggestion how I can achieve this or some related source please let me know.

How to align long texts? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I want to align a pair of long texts with ~20M chars each.
I've used in the past Smith-Waterman algorithm but (from my limited understanding) it requires creating a 2-dimensional array with the size of the texts (20M by 20M array) - which is not practical.
So I'm looking for an algorithm to align a pair of long texts that will keep a practical memory size and execution time.
UPDATE
I've also tried Myers and Miller using this implementation: https://www.codeproject.com/Articles/42279/Investigating-Myers-diff-algorithm-Part-of
But I still got out of memory exception on "not so large" texts (1MB).

What are some heuristics for choosing a diff algorithm? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
The Myers diff algorithm performs well when the differences between the two texts are small, because most simple implementations have complexity O((N+M) * D). However when differences are large, it takes a very long time to run. For example, if one of the texts is large and the other is the empty string, many implementations take several minutes to run.
If you knew the differences were large, then you could choose a different algorithm. How do diff tools make this determination in practice?

I am at a crossroads in my program and I was wondering which path would be more efficient time wise [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 7 years ago.
Improve this question
I currently see two ways to code the next step of my program and there are probably more, but the two routes I have are as follows.
I take the factors of the lowest number and loop through the other numbers two see if they share those common factors.
I find the factors of the lowest number and add it to a list. I then find the factors of the other numbers that do not exceed the lowest and add them to the same list. I then run through the list to check which is the highest number that appears x times.
I am leaning towards 1, but I'm not sure.
Sorry if this is too ambiguous, thanks.
Well, given the ambiguity, as stated: the 1st requires less steps and avoids the allocation of a data structure.

Interview ques : Sorting 20 GB data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Given 20 GB of data (normally numbers) and you have only 1GB of RAM, How will you sort the data?
You can use something similar to merge sort.
Sort 20 groups of numbers and write them to disk. Once their sorted read from all groups simultaneously using a buffer and print out the ordered master set. For this last merge step you should only need constant memory.

Resources