consider the function below which converts the result of a * b in a couple of numbers i and j, where: a, b, x, y are int (Suppose they are always => 32bit-long) a and b are <= n*m, where n = 10^3 and m=10^5. n*m = BASE. a * b can be written as i*BAS

I am making a game in HTML5, JS. In the game I perform the collisions by circle-shapes since my sprites are rotating. The player has different shapes since it has different sprites when it holds different weapons. The radius of the player is half the

I dont know if this is possible at all but: Say we got 2 queues: queue1 and queue2, and each queue includes (natural) numbers that are sorted from lowest to greatest (queue1.head() and queue2.head() return the smallest value of queue1 / queue2). How

Given an array of node and an array of edges, how do you calculate the number of connected graphs?You can use a union find (you can search it up). Start with all of the nodes as separate sets, then for each edge join the two nodes that the edge conne

This question already has an answer here: How would you program Pascal's triangle in R? 2 answers How to work with large numbers in R? 1 answer For a class assignment, I need to create a function that calculates n Choose k. I did just that, and it wo

I need help with my program in Visual Studio C#. The user must be able to enter a value into the four blank textboxes. The numbers in the textboxes should multiply with their set prices when the user clicks on Calculate. In other words, I want the fo

I use the ~ operation for bit manipulation, and I'm just wondering how Java calculates the negative number? I checked the Java documentation: "The unary bitwise complement operator "~" inverts a bit pattern; it can be applied to any of the

I have a problem where i have to find missing numbers within an array and add them to a set. The question goes like so: Array of size (n-m) with numbers from 1..n with m of them missing. Find one all of the missing numbers in O(log). Array is sorted.

I need to calculate permutations iteratively. The method signature looks like: int[][] permute(int n) For n = 3 for example, the return value would be: [[0,1,2], [0,2,1], [1,0,2], [1,2,0], [2,0,1], [2,1,0]] How would you go about doing this iterative

I am writing a program that takes in an ArrayList and I need to calculate all possible permutations starting with a list of zeroes, up to the value in the corresponding input list. Does anyone know how to iteratively calculate these values? For examp

Let's say I have this: .example { background-color: rgba(0, 0, 0, 0.5); border-color: rgba(0, 0, 0, 0.5); } The background-color and border-color have the same rgba value, but are different colors because the border-color is calculated on top of the

I am working with historical price data of many different products. I have a table products that lists all products with their name, description etc., identifying them with an uuid. Then there is another table history that stores every price change e

Possible Duplicate: How do I calculate the last day of the month in SQL? New to SQL, but how would you determine the last day of the month value from datetime (trans_date). Sorry just a dumb question, but rather than using current date can I specify

This question was here for other languages, so let here be one for Ruby. How do I calculate number of complete years that have passed from a given date? As you probably have guessed, that's to calculate person's age automatically. The closest one is