All Questions
Tagged with programming-logicalgorithms
6 questions
21votes
9answers
9kviews
How to turn truth table into smallest possible if / else block
How can I take a truth table and turn it into a compacted if block? For instance, let's say I have this truth table where A and B are conditions and x, y and z are possible actions: A B | x y z -----...
1vote
1answer
151views
Ranking results from a Question and Answer game
I have a question and answer trivia game app which randomly picks questions from a database and prompts the user to answer the question correctly. The total number of correct answers, the total number ...
5votes
4answers
1kviews
Finding an object on an infinite line
Question: There is an infinite line. You are standing at a particular point you can either move 1 step forward or 1 step backward. You have to search for an object in that infinite line. Your object ...
1vote
1answer
1kviews
Finding the minimum transaction
Given a list of transactions like: A -> 10 to B B -> 10 to C The naive way to settle the transaction would be: C owes 10 to B B owes 10 to A But the same transaction could be settled by: C ...
2votes
1answer
2kviews
Sudoku Solver BackTracking vs Simulated Annealing
Before you read any further, assume you know what sudoku game and how to go about solving it. So I have created a sudoku solver with brute-force: The algorithm goes as calculate(through an simple ...
0votes
1answer
767views
Creating algorithms [closed]
I am a relatively new programmer. I can pick up languages and learn syntax at a speed that I consider good, but I can't figure out how to solve problems logically using algorithms very well. I know ...