brute-force

Why is this brute force algorithm producing the incorrect result?

情到浓时终转凉″ 提交于 2019-12-12 05:38:29
问题 I'm trying to write a brute-force algorithm that minimises the number of journeys of a herd of cows, subject to the conditions in the docstring. def brute_force_cow_transport(cows,limit=10): """ Finds the allocation of cows that minimizes the number of spaceship trips via brute force. The brute force algorithm should follow the following method: 1. Enumerate all possible ways that the cows can be divided into separate trips 2. Select the allocation that minimizes the number of trips without

Password guessing program problems

时光怂恿深爱的人放手 提交于 2019-12-11 15:05:43
问题 I'm having a few issues with an extra credit assignment for my Java class. The objective is to decrypt a file without the password. It is encrypted with the PBEWithSHA1AndDESede algorithm and the password is a dictionary word with no numbers or special characters. The way I'm trying to solve this is by guessing the password over and over again until I get it right using the code below. The problem I'm running into is that the extra_out.txt file is being output after the first cycle of the for

Rearranging an array with respect to another array

为君一笑 提交于 2019-12-11 12:20:07
问题 I have 2 arrays, in parallel: defenders = {1,5,7,9,12,18}; attackers = {3,10,14,15,17,18}; Both are sorted, what I am trying to do is rearrange the defending array's values so that they win more games (defender[i] > attacker[i]) but I am having issues on how to swap the values in the defenders array. So in reality we are only working with the defenders array with respect to the attackers. I have this but if anything it isn't shifting much and Im pretty sure I'm not doing it right. Its suppose

Brute force Sudoku algorithm [duplicate]

隐身守侯 提交于 2019-12-11 11:10:12
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Sudoku algorithm, brute force For several days I have tried to write a brute force algorithm for solving sudoku, my problem is that I never realy get the algorithm to work 100 %, can someone please direct me and give some help ? The Algorithm is located in Square class, recursive function. public abstract class Square { private Square next; private Box box; private Row row; private Columne columne; private int

How to find best solution from all brute force combinations?

耗尽温柔 提交于 2019-12-11 05:17:43
问题 I want to find the best solution from all brute force combinations of a dictionary. For the context of the problem, I need to find out the minimum number of trips needed to transport all the cows given a weight limit. The combinations are already given to me with the helper functions get_partitions . The function returns a nested list, with each inner list represents a trip and names of cows on that trip. Helper functions: def partitions(set_): if not set_: yield [] return for i in range(2*

Calculate all combinations of a given character set, for brute force matching?

浪尽此生 提交于 2019-12-11 02:45:51
问题 In practising multithreading, I had wished to simply build an application that could calculate all possible combinations of a character set (i.e. brute force cracking/matching) and distributing work among threads, to really get to measure and see first hand how the threading can affect the algorithm's time on different systems. The algorithm to calculate this, has been a great challenge to me so far. On a recent thread (What would be an efficient way to add multithreading to this simple

What would be an efficient way to add multithreading to this simple algorithm?

久未见 提交于 2019-12-11 00:18:49
问题 I would say my knowledge in C is fair, and I wish to extend a program to enhance my knowledge of parallel programming. It essentially the program I am refering to is a brute force generator, to increment through passwords such as from 0000 .. zzzz of a specific character set: Need help with brute force code for crypt(3) The algorithm is outlined below (credit to Jerome for this) int len = 3; char letters[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; int nbletters =

Brute force magic squares

非 Y 不嫁゛ 提交于 2019-12-10 20:38:46
问题 Basically I have a 3 x 3 grid that is filled with two digit numbers 00 - 99. Some of the numbers are given as input the rest are unknown. What are some suggestions on how to solve such a problem with brute force in C? EDIT: Sorry I forgot part of the problem. Every row and column and diagonal must add up to the same number. I don't want any code just some ideas to get started with algorithm 回答1: There is a simple recursive solution to your problem, which is an example of a type of brute force

Emulation of ejecting and plugging in a USB drive on Windows

不想你离开。 提交于 2019-12-10 17:36:21
问题 I forgot my WD Passport Ultra disk's hardware encryption password and I am having a Delphi software being programmed for finding this password using brute force method. Original WD Security software will be used for password entries, but WD Security software locks itself at every 5 wrong password entries. Then the drive needs to be physically ejected and plugged in to reset this counter. Therefore the software being programmed must emulate safely removing and plugging in of an external USB

How is Greedy Technique different from Exhaustive Search?

别来无恙 提交于 2019-12-10 15:44:07
问题 I have some sample problems that I'm writing pseudo code for and I'm noticing alarming patterns between the greedy technique and exhaustive search. Job 1, Job 2, Job 3, Job 4, Job 5 Person: 1 9 2 7 8 Person: 2 6 4 3 7 Person: 3 5 8 1 8 Person: 4 7 6 9 4 The above is the table example of an assignment problem. Basically, you have n amount of jobs to do, five here, and you need to complete them in the smallest amount of them were time is shown by the values attached to each person and their job