Skip to content
Advertisement

Tag: algorithm

Using Knapsack approach without value?

Regarding to question, I am wondering that according to the following approach: Assume that there is no value and I am wondering that which approach or algorithm should be used for a Knapsack problem when the values are equal and there is a parameter (called n) that describes times for carrying items in a time? For example, the bag has

Java program failing on specific test case [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 last year. Improve this question I wrote a java program that does basically what wordle does. Given 2 3×3 rows, for example If the guess matches the answer (in this case

Prefix To Postfix Java

I need some help with my prefix to postfix code. When ever I generate the action through GUI from the expression “* 2 + 2 – + 12 9 2” it returns 2*. It should be returning “2 2 12 9 + 2 -+*”. I keep changing the code around and I keep ending up with the same result. Please

How to get better time complexity of N queens validator

How can we lower the time complexity of this solution of NxN queens matrix validator? I have this solution while I check every row and every column and every diagonal of the matrix. If every row and column has exactly 1 queen, and the matrix has no more than 1 queen the output is true. This solution works but I

Image compression and decompression Java

I want to create a program which compresses and decompresses images , there are many algorithms to do that , but I was asked to use the LZSS algorithm to compress and decompress the images , my question is that isn’t the LZSS a dictionary type data compression method ? used only for text files ? or am I wrong

Java Quick Sort Performance

I was doing sorting array problems and found one of the quick sorting solution extremely fast, and the only difference is the two lines of code in function 1Partition. Wondering why the following two lines of code in 1Partition can greatly improve the performance: Here’s the full source code: } Answer I guess you are doing the question on a

Advertisement