Skip to main content
Share Your Experience: Take the 2024 Developer Survey
9 votes
Accepted

Practices for navigating uncertainty in software design

You don't architect your "framework". You can use many different techniques to determine what it is you want your game to do. Then you just start doing it. As you go along you make decisions on if a ...
coteyr's user avatar
  • 2,533
8 votes
Accepted

Smallest Rubik's cube state representation

You can encode the 8! possible permutations of the corners in 16 bits, and the 12! possible permutations in 29 bits, by numbering the permutations from 1 to 8! (or 1 to 12!), and storing the number. I ...
Doc Brown's user avatar
  • 208k
6 votes
Accepted

Algorithm for floor tiling

As I've commented already, this question made me curious, and the problem looks simple enough that it should be possible to solve it with a relatively simple algorithm. TL;DR: Here's the JS fiddle ...
Hans-Martin Mosner's user avatar
5 votes
Accepted

Understanding of the Carry Flag Bit

It is just by definition that the carry output of the last ALU operation is captured to bit-0 of the flags. This kind of thing is relatively easy for hardware to accomplish in a number of ways. It ...
Erik Eidt's user avatar
  • 34.1k
4 votes
Accepted

Difficulties with Two's complement in Assembly

First, the CPU just does what you tell it. Someone else has to translate an expression into CPU instructions. Second, -x-(-y)=z and -x+y=z are equations (relation formulas), not assignment ...
Erik Eidt's user avatar
  • 34.1k
3 votes

a valid ranking algorithm for facebook posts

For creating a formula to map those parameters to a ranking value, first map each parameter to a positive real number. Then a simple approach is to make a weighted sum from these numbers. The ...
Doc Brown's user avatar
  • 208k
3 votes
Accepted

Having trouble with AP computer science sample test problem

The code is a recursive function, meaning it calls itself over and over again, each time reducing the size of the problem until it reaches a point where it no longer calls itself but returns a value. ...
Tulains Córdova's user avatar
3 votes

Having trouble with AP computer science sample test problem

Walk through the function using some actual data. The preconditions say that your input array is going to be presorted, with no duplicates. So let's make such an array (this is going to be mostly ...
Robert Harvey's user avatar
2 votes
Accepted

What is this Algorithm called? [Traveling Salesman Problem]

What you're doing is making a convex hull. Your algorithm won't be a perfect solution, just an approximation. Consider the following grid: Your algorithm would start by doing something like this: ...
Ucenna's user avatar
  • 1,302
2 votes
Accepted

How to reverse engineer URL routes from a bulk of HTTP requests/responses

So in generic terms you are looking for a fitness function to determine the probability that a web request will be handled by a code path that has not already been probed, based on the URL and the set ...
Ergwun's user avatar
  • 512
2 votes

How to measure how "changy" something is?

The best alternative would probably be to find some way to extract the update dates of the articles. That would let recreate an accurate timeline of all the changes, and that should let you estimate ...
JonasH's user avatar
  • 5,544
2 votes
Accepted

Recognize bug or inability to solve a problem by yourself

I highly recommend working with other programmers if you are hitting a roadblock. Often the conversation goes something like this: [you] I'm stuck on this bug, I can't seem to figure out what's ...
JimmyJames's user avatar
  • 27.5k
1 vote

Conceptual approach to identifying duplicates

You'd have to concentrate on analysing why the duplicates arise, and what effects they typically have in the data. For example, you seem to be saying transactions can be "duplicates" where ...
Steve's user avatar
  • 8,949
1 vote
Accepted

Determining resource exhaustion beforehand

In general, this looks like an NP-complete problem. This means that a brute-force approach is essentially the optimal solution (that we know of) if the compatibility table can be any value at all. In ...
Kilian Foth's user avatar
1 vote
Accepted

The problem of letting the receiver instead of the sender generate an ID

This is a common problem in distributed systems. The issue is that you have two competing requirements: the server wants a globally unique ID (and is in a position to enforce it) the client wants a ...
Useless's user avatar
  • 12.6k
1 vote
Accepted

Which class of problems is this?

There are different ways to classify this problem. For example: combinatorics : it’s about choosing and combining elements in a way to comply with rules/constraints (combinatorial analysis) and find ...
Christophe's user avatar
  • 77.9k
1 vote

How to identify rules satisfying a certain condition based on events

This is solved by storing the rules in a tree, same approach as a prefix tree. Assuming you have a way to identify which classes are used by which rule: For every rule Generate the unique list of ...
Martin K's user avatar
  • 2,917
1 vote

How to manage cart details across various devices

Your answer is reasonably correct, but I think you're going too granular with the details. You've hit the nail on the head but it takes some effort to filter that nail)hitting part out from other ...
Flater's user avatar
  • 51.7k
1 vote
Accepted

How to resolve multiple user serve on multiple location appointment booking system

This is a fairly common problem with many applications that have multiple users. The simplest solution is to check that the appointment is available before inserting and return an error if its taken. ...
Ryathal's user avatar
  • 13.4k
1 vote
Accepted

Trying to teach a high school student Dynamic Memory Allocation - what are the best ways to do so?

Based on the feedback I have received and thinking about it for a while I've realized quite a few key points in my question that I think lead to a solution to this issue. The person I am working with ...
user64742's user avatar
  • 145
1 vote

Recognize bug or inability to solve a problem by yourself

Most bugs you can solve by inspection, but this relies on your experience and skill. BUT! if you have a hard bug or complex code, you don't need to do it the 'quick' way. You simply add more and more ...
Ewan's user avatar
  • 76.4k

Only top scored, non community-wiki answers of a minimum length are eligible