Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [binary]

The tag has no usage guidance.

1
vote
1answer
14 views

Binary Floating Point Range/Precision for 4-bit Mantissa and 4-bit Exponent

I'm trying to understand binary floating point and using just a 4-bit mantissa and a 4-bit exponent (both 2s compliment) to keep things simple. As far as I can tell, the largest denary number I can ...
0
votes
1answer
28 views

How to transform a Infinite decimal of $\frac{23}{6}$ into binary?

How to transform a decimal of $\frac{23}{6}$ into binary? $\frac{23}{6}$ is equal to $3.83333\bar{33}$, where the digit $3$s are repeated forever. I do know how to translate finite decimal into ...
2
votes
4answers
60 views

Binary 2s Compliment Applied Twice Gives Original - How?

At the moment the maths behind binary 2s compliment seems like voodoo to me. If I take 0011 (+3) and "flip and add 1", I get 1101 (-3) If I apply the same process to 1101, ("flip and add 1"), I get ...
-3
votes
0answers
16 views

Which of the following sequences are possible sequences of numbers that were encountered in this search for a binary search tree? [duplicate]

Suppose you have a binary search tree T and you do a search for the integer 250. Which of the following sequences are possible sequences of numbers that were encountered in this search. For the ones ...
1
vote
0answers
10 views

How can I optimise a 8b10b encoding for maximum alignment?

Imagine you encode an 8 bit symbol as a 10 bit symbol that is sent sequentially over a wire. The goal at the receiver is to detect the byte boundary. Since there are 4 times more encoded symbols than ...
0
votes
0answers
16 views

IEEE-754 and machine numbers

I've been trying to wrap my head around machine numbers like the unit roundoff (u) and epsilon (e) in combination with the IEEE 754 standard. My textbook states some things that don't really make ...
0
votes
0answers
22 views

Worst case lower bound of binary search

For the question below, it is asking to prove the lower bound on the worst case is log(n). I have no problem proving this and the solution makes 100% sense to me. However, there is a comment at the ...
2
votes
1answer
30 views

Two's complement general formula

In college, we've seen some general formulas to compute the decimal value a of a binary representation $a_{N-1} \dots a_2 a_1 a_0$ in two's complement, $N$ being the number of bits. For $a \ge 0$ we'...
-1
votes
0answers
23 views

What are the advantages of using gibibytes instead of gigabytes?

I have read that gibibytes (or any other variant) uses base 2 notation (gibibyte = 2^30) which causes these units to differ from the base 10 units (giga, mega etc.). Since these units are referring to ...
14
votes
3answers
2k views

Shannon Entropy of 0.922, 3 Distinct Values

Given a string of values $AAAAAAAABC$, the Shannon Entropy in log base $2$ comes to $0.922$. From what I understand, in base $2$ the Shannon Entropy rounded up is the minimum number of bits ...
0
votes
1answer
24 views

Need help converting machine code

I would appreciate some help with this question. The 32 bit numbers below represent a MIPS instruction. identify the different fields and state which instruction it is. give the assembler source code ...
3
votes
2answers
38 views

How many unique counting functions there are for strings of N bits?

Let a counting function inc for inputs of N bits be defined as: ...
0
votes
1answer
52 views

Bytes from integer using bitwise operators

So I am extremely confused with using bitwise shifts used to extract the bytes from an integer. I find that if I do something like this... ...
2
votes
1answer
56 views

What exactly is a “binary file”?

I suspect this may be more of a concept / theory question, but, I haven't been able to wrap my brain around what exactly a binary file is. I've read links such as the below: https://en.wikipedia.org/...
5
votes
0answers
112 views

Partitioning through block moves to the end

Suppose we have a binary string $s$. We wish to partition this string in a series of $0$s followed by $1$s (alternatively: we wish to sort), using only one operation: moving three consecutive elements ...
2
votes
1answer
577 views

Confusion in 2's complement of 00000000

I'm solving the end of the chapter problems of Morris Mano's Digital Design (4th Edition, if that's relevant). In one of the problems, it is asked to simply find the 1's and 2's complement of 00000000....
0
votes
0answers
16 views

Is this the right way to convert a negative floating point number in binary using two's complement method?

I'm a cs student and i've just started learning about binary arithmetic.I have to do this homework assignement to get prepared for exams..I'm having some trouble figuring out how to convert a negative ...
1
vote
0answers
29 views

If 2's complement is the best way to represent numbers in computers, why worry about BCD and other binary codes?

I'm studying Digital Logic and Design. And in the first chapter, there's all this information about various binary codes. I did some searching on youtube and found this awesome video - https://www....
-1
votes
1answer
29 views

How can the binary OR function be computed by a MOD3 gate of constant fan-in?

I've been working on a problem and in order to prove the bigger picture, I need to understand how a binary OR function can be computed by a constant fan-in MOD3 gate. I would seem that the output ...
1
vote
1answer
51 views

what does “vector” mean in computer science?

I am trying to understand how computers work under the hood, and I came across following sentence. "Computer technology is based on electronic circuits able to process vectors of 0's and 1's. For ...
5
votes
1answer
75 views

Could a standardized ternary system be more efficient than the binary system? [duplicate]

Could a standardized ternary (base-3) system be more efficient than the binary (base-2) system? Binary is efficient for processing using logic gates, but can be bulky when using for file storage or ...
2
votes
2answers
136 views
0
votes
2answers
128 views

Fast searching through bitarray?

I've been thinking for some time but can't figure a way out. I have big bitarray i.e. 1000+ items of 10_000 bits strings, I'm searching them now linearly. (currently it is stored in one chunk of ...
2
votes
1answer
129 views

Binary code and Hamming distance

I'm learning about CRC and Hamming distance and I have three questions. Lets say we have binary code described by ($+$ refers to sum modulo $2$): \begin{alignat*}{1} a_1 &+ a_2 &+ a_3 &+ ...
4
votes
3answers
613 views

Why does the formula 2n + 1 find the child node in a binary heap?

I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, ...] the indicies of the children of element at index n can be found with $...
0
votes
1answer
261 views

Logic Circuits - Binary divisible by 16 [closed]

I have a question ...
0
votes
0answers
44 views

Avoiding overflow when comparing between 16-bit numbers

Let's say I have a 16-bit number system. and let $a, b$ a 16-bit numbers in this system. I know that the numbers I can represent in this system are between $−32,768$ and $32,767$. Let's say I want ...
4
votes
1answer
542 views

Computing Hamming Distance Between Binary Vectors

Consider the following problem: Input: We are given a set $S$ of $n$ binary vectors. A binary vector is of the form $(b_0, b_1, ... b_n)$, where $b_i \in \{0, 1\}$. Therefore, there are $n$ vectors ...
1
vote
1answer
38 views

Converting a 32-bit bit pattern into floating point number

In The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D. i have read something like that, Single precision or 32-bit floating point forms the floating point number,...
0
votes
1answer
274 views

Assembly language translation to machine code (process in “RAM”) [closed]

How does a assembler (at very basic level) work in translation of Assembly language to machine code ? Just want to know that what is happening in RAM ? [What my understanding is that when when I ...
1
vote
1answer
99 views

n-bit 2's Complement Conversion

I'm learning 2's complement conversion for positional number systems. For the most part I have only seen 2's comp for represented in 8-bits. I had a discussion with a friend who explained that for ...
8
votes
4answers
5k views

How can I multiply a binary representation by ten using logic gates?

So I’m currently working on something and I have converted all decimal digits 0-9 into binary. But now I want to take say 6 in binary and increase its order of magnitude by base 10 (turning 6 into 60) ...
0
votes
0answers
118 views

As a number (base 10) approaches infinity, what would be longer? Represented in BCD or Base-2?

My professor asked this question in his lecture class and I can't figure out the answer. My guess is BCD because you can't use up all the numbers (10 to 15), so you eat up space?
1
vote
0answers
101 views

Most efficient way to calculate log base 2

I recently started learning stuff with bits and now while I was solving one problem, I started thinking what is the most efficient way to calculate $$\lfloor \log_{2}K\rfloor$$ What I started ...
2
votes
0answers
129 views

K-ary tree that wrapped around

I'm not sure the best way to name this problem, but basically I need to construct a complete $k$-ary tree for $k \geq 2$ which has this nice property as $k=1$ tree that we can create a ring out of it. ...