Share Your Experience: Take the 2024 Developer Survey

# Tag Info

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 ...
• 2,533
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 ...
• 208k
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 ...
• 16.6k
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 ...
• 34.1k
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 ...
• 34.1k

### 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 ...
• 208k
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. ...
• 39.4k

### 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 ...
• 200k
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: ...
• 1,302
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 ...
• 512

### 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 ...
• 5,544
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 ...
• 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 ...
• 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 ...
• 109k
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 ...
• 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 ...
• 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 ...
• 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 ...
• 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. ...
• 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 ...
• 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 ...
• 76.4k

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