Skip to main content

Questions tagged [binary]

For questions about representing numbers in base 2 or performing arithmetic on them.

-1 votes
0 answers
19 views

Algorithm Design Binary Tree

I have this request: "Design an algorithm that sums all node values within a tree and compares the result to a target value. If the sum is equal to the target, return 1; otherwise, return 0."...
Gabriele's user avatar
0 votes
0 answers
39 views

How to check if a hexadecimal addition is correct in two’s complement and whether overflow occurs?

Given this addition, $9999_{16} + 1111_{16} = AAAA_{16}$, I'm supposed to interpret the operands and the result as signed integers in two's complement. How can I tell if the result is correct, and ...
belibel's user avatar
1 vote
0 answers
59 views

Möller-Granlund Reciprocal Calculation for Arbitrary Bases

In their paper Improved division by invariant integers, Niels Möoller and Torbjörn Granlund describe an algorithm (Algorithm 2 and Algorithm 3) based on Newton-Raphson iteration to efficiently ...
Marc Nieper-Wißkirchen's user avatar
0 votes
1 answer
84 views

Understanding representation of boolean formulas in binary strings

We are given boolean formulas with common conventions such as operators are $\neg ,\land ,\lor$, operands have form $x_i$, for $i\in\mathbb{N}$, etc. There are some ways to convert a certain boolean ...
minh quý lê's user avatar
5 votes
2 answers
1k views

Big Transition of Binary Counting in perspective of IEEE754 floating point

If I iterate over binary representations from 000...000 to 111...111, is there a significant transition at some point? In the ...
Muhammad Ikhwan Perwira's user avatar
-1 votes
2 answers
100 views

how do you construct a binary if it has duplicate values

i only know that N is the root of the tree but there is duplicate N in this case for example POSTORDER traversal: Y, H, E, A, N , H, O, I, T, P, N INORDER traversal: H, Y, P, H, E, N, A, T, I, O, N
user172665's user avatar
2 votes
1 answer
524 views

Data type implementation of 1.58 bits

In Large Language Models, using 1-bit binary weights (BitNet: Scaling 1-bit Transformers for Large Language Models - Wang et al, 2023) instead of 32-bit floating point weights has numerous advantages. ...
ahron's user avatar
  • 123
-1 votes
1 answer
91 views

Why is ot returning TRUE in first case and FALSE in the second?

I understand 0.3 does not have an accurate binary representation. Suppose I run the following code: Why is the answer "True" in the first case and "False" in the second? Shouldn't ...
descartescat's user avatar
-1 votes
1 answer
142 views

Multiplying and dividing binary data

So in school today we were learning about Binary shifts to the LSL#$n$ and RSL#$n$, where $n$ is an integer. I shifted a binary number to the left using the logical shift operation, hence multiplying ...
likes theoretical ideas's user avatar
0 votes
0 answers
49 views

Confusion on 1 bit precession

We know binary representation of $\frac{1}{3}=0.010101..$. What will its 1 bits precession $0.0$ or 0.1? Note that $0.1=\frac{1}{2}$ is closer to $\frac{1}{3}$ than $0.0=0$.
Sanu's user avatar
  • 49
2 votes
1 answer
139 views

Conditional Maximization of a Binary Matrix

Given an $L \times N$ matrix $A$ with only binary values, $A_{ij} \in \{0, 1\}$, and a vector $b$ with $b_j = 2^{j-1}$, I want to find a matrix $\tilde{A}$ that maximizes $\tilde{c}=\tilde{A}b$, ...
Dan's user avatar
  • 61
0 votes
2 answers
251 views

A good way to hash two numbers with known properties together

I have two 64-bit numbers a and b which have a few properties: only 49 out of the 64 bits are used (15 bits are always 0), and ...
Rak Laptudirm's user avatar
0 votes
1 answer
79 views

What is the value range for absolute value formulation of binary variable

According to this link binary variables - absolute values the formula of some binary variables like absolute value is : y = | x1 - x2| for two variables x1, x2 with 0 ≤ xi ≤ U Introduce binary ...
SnoopyKid's user avatar
  • 101
0 votes
2 answers
186 views

why didn't ASCII/utf-8 used 00000000 to represent char 0 or rather any other character

I mean why value of 0 value in binary is not used by ascii encoding , it would have been used to represent char 0 or anything else why they used it to represent NULL
Shubham Atkal's user avatar
0 votes
3 answers
156 views

Is there an algorithm to implement N-input-gates using smaller gates?

To borrow part of a description from a similar but distinct question: there exist 2^(2^N) different functions which accept N binary inputs and return a 1 bit output. For the purposes of my question I ...
HappMacDonald's user avatar

15 30 50 per page
1
2 3 4 5
12