# Binary Questions

Ad

## C - recursion not working in a Binary Search Tree

I'm implementing a bst in c. if the tree only has 2 leaves and nothing in between, recursion works. but as soon as it goes deeper (eg below 3

## How to count occurrences of duplicates in array using binary search in C?

I must count the occurrence of an element in the array using binary search in c. i have written the following code but when i use to give an input

## Trying to make Binary Search Tree, but program freezes. Can you check my code?

Is there something in this that i don't understand or is this one of those times that i'm going to need to use the alloc

## Diffrent usage of &- operator

Look at the following code: #include <stdio.h> int main() { int num, sum; scanf("%d", &num); sum =

## Recursive Binary Search Program C

The following code works good if the key is less than equal to 11 but if the key is greater than 11 it does not return anything.

## How does recursion work on traversing through a binary tree, and counting the number of list nodes?

I have trouble visualizing these following print and size functions from the following url

## Segmentation Fault error - binary search tree in C

I'm trying to build a binary search tree. inserting an integer using insert function (only using 1 to 100 for testing) and appending the result to

## Segmentation fault, while dequeuing

I'm quite new to ds and i'm trying to implement binary tree level order traversal using a queue. the algorithm is as below.

## Fastest way to "sort" bit sequence by toggling bits

Given a finite random sequence of bits, how can the minimum number of bit toggles necessary to result in a sorted sequence (i.e. any and all 0's

## Fastest Way to convert a Binary String to Binary Array (Array of 1 and 0)

I am trying to find the fastest possible way to convert a binary string to an array of integer 0 and 1.

Ad

## Get all possible boolean sequences for a given list length

Given a random list length, how can i efficiently get all possible sequences of boolean values, except strings that are all true or all

## Why is my Binary search stuck in an endless loop?

I just had to pop in here to hopefully get a quick answer to my little problem. i'm trying to create a binary search method but ran into some

## I want to search for values in binary search tree using iteration

Hello i wrote this method to search for values in my binary search tree but it is always returning false whether the value is found in my bst or

## Load ARM (MIPS-MIPS32) Linux filesystem on VMware?

I have a linux firmware for the mips architecture. would it be possible to load up a firmware image like this in vmware? i am trying to get into

## Binary Tree construction from mutliple subtree

I have the following input like : 1:2:3 2:4:x 3:x:5 which output like following binary tree: root 1

## Merge binary Strings and Insert bits in C

Function insertbits x and y are two integer values. the function insertbits must insert all the bits of y after the last set bit in

## Processing binary data containing different length

So i have some binary data that i read, process and need to "split" into different variables, like this: int *buffer;

## Convert 64-Bit Binary floating-point number into a base 10 decimal

I have a task to convert a 64-bit binary floating-point number into a base 10 decimal. an example here:

## Will std::lower_bound be logarithmic for list<>?

Suppose i have a list<int> and maintaining it in ordered state. can i isert new values into it with logarithmic complexity with

## Why is signed char min -128 and not -127?

Singed numbers in memory are represented in such a way that the first bit defines a sign. i've taken a char as an example (and as a simpliest type

## How to Decode Compressed Binary .RAW Files from LTspice with python

I am trying to read from .raw ltspice files. in the control panel of ltspice, there is a possibility to switch between ascii and binary

Ad

## Finding the maximum height of left and right subtree

I would like to implement the following function: def get_height(root, d): if root.left: left =

## How to edit binary file in Android?

I want to create an app that can open binary file, read and edit it's content in decimal values, and then save it back to binary file.

## Converting from binary to text in python

I have 10 .npy files and i tried to convert them into a text format . eventually i could convert but inside of the file i have a lot

## Binary Search tree time complexity

I am right now working with a binary search tree. i wonder what is the tim complexity for a binary search tree. more specific what is the worst

## PHP: How to save binary string in MySQL 5.7

How can i convert this binary string: b"iphoné[email protected],;= ÑÑñe x" to normal string? i really need to have

## How can code binary mlm registration system in JavaScript node.js

I am now studying in javascript nodejs.i know mean stack developer can make both frontend and backend but i have no idea how can make binary

## Checking if Inserting values in order into an initially empty minimum binary heap is correct

Can someone tell me if i have produced the right minimum binary heap after inserting these values in order into an initially empty minimum binary

## Creating a Binary Search Tree using Binary Search Tree class Implementation

I have defined the binarysearchtree class below: class binarysearchtree: def __init__(self, data, left=none,

## I wanted to do a Binary search but the result is faulty

I wanted to do binary search on a list but the result shows 'false' even if i check a number from the list. def clist(a): l =

## How to create a binary file?

I want to create my own binary file. when i've opened a .3ds file, at the beginning i've found :

## Numpy searchsorted on array of vectors in one dimension

I've been googling this for a while now, even though i think it's a common problem, i don't see there's a solution anywhere on so. say i

Ad

## Improve speed of my binary search algorithm

I have written a binary search algorithm in javascript: function binarysearch(number, array) { let left = 0; let right =

## How to center a graph view or Tree View in flutter?

Interactiveviewer( constrained: false, boundarymargin: const edgeinsets.all(20), child: container(

## find max. leaf nodes of a binary tree

50 / \ 25 75 / \ / \ 15 27 62 79 depth = 3 total nodes = 7 max leaf nodes = 4

## How to convert binary into a string in python?

I have been trying to convert my binary into a string in python. haven't really figured out any solution at all. anyone got an idea? below is my

## How to split a Buffer in Node.js by newline

Say we have a buffer b: const b = buffer.from('foo\nbar\nbaz'); is there a way to split the buffer into n

## How to assign binary values to values in a csv column in python?

I have a dataframe index and want to add a column dummy with ones and zeros depending on the value of the index. the

## how to compare two number to find number of corresponding different digits

I have two number 1100 and 1010 then i would like to find out the number of different corresponding digits among them,

## What does the position number mean in this UnicodeError : 'gbk' codec can't decode byte 0x91 in position 2196”

It often occurs to me when i try to manipulate data, for example "unicodedecodeerror: 'gbk' codec can't decode byte 0x91 in position 2196:

## Binary to Decimal conversion not working properly: C++

Can anyone please help me with this code i wrote. i am multiplying the digit from the string that is either 0 or 1 by 2 to the power of

## What happens when you call a function in it self?

I saw an example online that looks like this: def decimaltobinary(num): if num >= 1: decimaltobinary(num // 2)

## How can I set the number of bytes to be displayed by the binary form of a character in python?

I want to be able to set the number of bytes displayed by each character in the string to be 6. here, the string is jj and i'm

Ad

## An algorithm that determines the minimum leaf depth and the number of leaves in that depth

I need to make the algorithm that i indicated in the title, but i have a problem with the fact that i don’t know how to make it write out the

## Binary tree in Java implementation

My task is to implement a binary tree in java and do some operations on the tree e.g adding elements or showing the

## How to get the same offset between readelf/IDA and Aho-Corasick in a binary

First of all i'm new to working with binaries and hope this is not a stupid question. i have generated tables with sequences of

## How to convert a string into it's real binary representation (UTF-8 or whatever is currently used)?

I want to experiment with utf-8 and unicode, for that i want to build a small website which helps me to understand the encoding better.

## Binary Sequence for activity of a user

I have a binary sequence for the activity period of a user. there is a "0" when he was not active on this day and a "1" when he was. i want to

## python binary tree iterator - why returned node becomes None?

I'm scratching my head for an hour. i implemented binary tree in-order traversal using the iterator & stack. class

## How to add a binary data file in the same directory as of exe using pyinstaller?

I have a binary text file which i want to embed in --onefile using pyinstaller. the text file should be in the same directory as of

## Using 'request' in node to download image from URL as buffer and then insert into SQL database as varbinary(max)

I'm authenticating users with google/facebook/ms oauth and i'm then giving them a refresh token. i then use this long-lived refresh token to make

## Why does Node.js not output 0's and 1's for a binary value?

I am trying to learn binary and build a library for a programming idea i came up with, to better my understanding of javascript and fundamental

## insert binary img as html to pdf with node html-pdf

I try to insert a binary image to html to generate a pdf from html doc with the node module html-pdf. according to other questions i tried

## Python: Trying to split instream into bit sized chunks

Currently i'm reading an instream and splicing it into 3 byte chunks: instream_chunks = [instream[i:i+3]for i in range (0,

Ad

## Traverse a binary tree using dfs, stopping at a given point (in Python)

I'm learning about some basic computer science concepts. as a demo, i'm creating a script in python that will perform various functions on a

## Find minimum depth of binary tree solution does not work when one side of tree is null

I am trying to understand why my solution to find the minimum depth of binary tree does not work when one side of the tree is

## convert number to binary and store in multiple columns in pandas using python

I want to convert a number to binary and store in multiple columns in pandas using python. here is an example. df =

## How to convert hexdump string of PNG data to binary in Python 3?

I have a hexdump string of a small png file that i want to convert to binary for writing out a png file: clip = "0x89 0x50 0x4e

## Encoding and decoding binary data for inclusion into JSON with Python 3

I need to decide on a schema for including binary elements into a message object so that it can be decoded again on the receiving end (in my

## In Node.js how do I change (overwrite) a byte in a binary file without adding bytes

In node.js how do i change (overwrite) a byte in a binary file (at a certain offset) without adding bytes in between and changing its length?

## NodeJS: Download File and convert to binary string

I am pretty new to node.js and struggle with current topic: i am calling an api which returns me a file (audio.amr). i now need to convert

## nodejs zlib unzip binary data from socket

I receive some binary data via socket in nodejs, zipped using zlib. i do not have access to the source that origins the messages. when i

## How to find/print return value of a function?

Doing a basic binary search problem, but how do you know if it actually works if you cant see the number that's being returned??

## Reading png image from request using body-parser and Express

I am sending the following request to my server using postman:

## Why does right shift on positive number sometimes result in a negative number?

Right shifting a number in javascript sometimes results in a negative number. what is the reason behind that? can that be mitigated?

Ad

## How does "if right and left: return root" and the "return right or left" help us find the least common ancestor?

Class treenode: def __init__(self, data, left = none, right = none): self.data = data self.left = left self.right =

## Duplicating contents of bin file x times and keeping in order

I am attempting to take a binary file and duplicate the contents in order: say the file contains 101010101010101. i want to duplicate each

## Binary search vs linear search

I have the following implementation of binary search: import time numbers_one_to_hundred=[] for num in range(1,100001,2): #25 66 35

## Adding binary arrays with different size

I made binary arrays from number and its bit length per line, if 295289042101659 with 6 bits per line, number sizes 49 bit so in array, it would

## Is it possible to read the content of a Binary File as Dictionary in Python?

I have raw data files in binary format. while i have written the code earlier in matlab, i wanted to transform the same into python. i

## transform hex to binary and vice versa, but keeping them as integers

I know how to transform a hexadecimal integer into a binary string using the bin function, but is there an easy way to transform a hex integer

## Efficient search in a array of obj in Javascript

Let's say i've a preordered array of object such as this one: let data = [ { moment: '00:01', otherprop: 'something',

## How to print binary numbers using f"" string instead of .format()?

For printing some numbers to their binary formats, we simply use the .format() method, like so: # binary for i in

## Laravel varbinary(ip) using with where not working

I'm using varbinary(16) to store ips in the database like described here

## android firebase database using material search filter all child value

I am trying to search data from firebase database. but i don't know. here i attached my firebase database screenshot. in my firebase database,

## How do i write a function in JavaScript that compares two trees defined by TreeNodes a and b?

I'm trying to write a javascript function that compares two binary trees defined by treenodes a and b and returns true if they are

Ad

## While loop will not stop in recursive binary search

I am trying to program a recursive binary search algorithm in python. however, i keep running into an infinite while-loop. i am afraid that it

## Turning binary into PDF in Ruby on Rails

I'm integrating with a third party id verification provider. once the id verification checks have run a report is generated, which i can access

## Adding single backslash to binary string in python

Am communicating with a piece of equipment over rs232, and it seems to only interpret commands correctly when issued commands in the following

## Dictionary graph to list by breadth-first order

I have the following graph (which is in this case is a binary tree) as a dictionary. g = { 'root': ['4', '3'], '4': ['2',

## Converting an Interger to a bool List in Dart

I have a number stored in in shared preferences. this number is a converted binary number that represents the state of a few user-changable

## Deleting a node with two children in BST

I have implemented a binary search tree and it is working fine except for the case where i have to delete a node with two children. the following

## Get all nodes on a given level in a binary tree with python

I am trying to get a list of nodes (objetcs) in a python binary tree, i am looking for a recursive function implemented in the node object, so i

## Differences in reading binary files between R and python

I have a binary file and i know the first 3 bytes should be 0x6c, 0x1b, and 0x01, in that order. i used python and r to load the file.

## Run a binary file with shared object dependencies on NodeJS / Express server

I'm using nodejs childprocess to run shell commands on nodejs /

## Is there any way to generate ELF BINARY using only python library?

Is there any way to generate elf binary using only the python library? i want to assemble the file below using python

## Dictionary using Balanced BST lookup time complexity

I was going through an article in

Ad

## Same code and same data but output different contents?

I have below code which is used to write the list array into a dat file , i ran on oneplus2 and the ide is android studio 1.3.

## Python Read part of large binary file

I have large binary file (size ~2.5gb). it contains header (size 336 byte) and seismic signal data (x, y and z channels) with

## how to get sibling node in binary search tree if there is no left child in a node

I'm trying to find the node for the first node whose data is greater than the value using recursion, but i found that i cannot go from n3 to n4 if

## Time complexity of bin() in Python

What is the time complexity of bin(n) in python, where n is a decimal number (integer)? for example: if

## Reading a binary file given the data structure

I am facing an issue in correctly reading the contents of a binary file, probably due to incorrect unpacking of the data structure (which is why

## Getting middle value of array to create balanced BST

I'm trying to find the middle element or index of an array then get the middle of each half, so on... so let say we have

## Why is the & 1 and + '0' is needed to display the binary number?

I got this code here to print the binary of a decimal, if i ran this function with argument as 3, it would print 0000 0011, which is right, i

## Binary Tree implemented in C using Python Api converts PyObject into Bytes

My pyobject becomes a bytes object while getting it's value so lately, i am doing a project in c, where i implement a few type of trees,

## c program binary cannot run in sh

I have cross-compiled an executable from c code for an arm-based embedded system. when i execute the binary in the embedded system, it gives the

## Windows/Visual Studio going wonky on a perfectly fine C program

Okay, no ego, maybe something is funny in the program, but gcc and clang are compiling it fine and running it just as intended on ubuntu 20.04 and

## How do I remove a specific leaf node with index value X and display the remaining leaf nodes?

Test case: input: 5 -1 0 0 1 1 2

Ad

## C Generate a header file via a Binary file

I'm trying to make a simple encryption type of stuff. so what i wanna do is read an executable's contents, encrypt it and generate a header file

## Binary Search Tree insertion/traversal not functioning properly

I'm trying to implement bst by inserting a few elements (5,8,10,20,30), and printing them by inorder traversal. but the output is:

Ad

## Blog Categories

Ad