Questions tagged [complement]

This tag is deprecated! Use more specific tags instead: For the binary representations of negative values in computer science, use tags [ones-complement] and [twos-complement]; For the bitwise complement operation, use [bitwise], or [regex-negation] for the use of complement patterns in regular expressions, or [bit-manipulation] for complementing said data.

This tag is deprecated! Please consider use of the following tags instead:

112 questions
1
vote
1 answer

Complement in ActiveRecord?

I am trying to find a complement using ActiveRecord and/or SQL. I have a collection of 'annotations' that each have two relevant fields: session_datum_id which corresponds to the user who performed the annotation. Null means it has not yet been…
1
vote
1 answer

Finding the decimal value of numbers in Two's and One's Complement

I want to turn a negative float number into decimal one but I dont know how to do it. for example I got the number 101.1011 and I need to find the decimal value in Two's complement ( the answer supposed to be -2.3125) and in One's complement (-2.25)
john smith
  • 13
  • 3
1
vote
1 answer

Confusion with 1's compliment binary representation

I was trying to learn binary representation of negative numbers. I tried to output 12 and ~12 in binary. print(~12) Output: -13 This was the 1's complement of 12. But my doubt is that binary 12 is 1100 and -13 (1's complement of 12) is 0011 but 3…
Gaurav
  • 333
  • 1
  • 16
1
vote
0 answers

Implmenting a complement graph function

I'm trying to implement an ! operator on Graph (complement operator) using - operator (difference operator). I'm getting the following error: Click here to view the image! K is the complete graph. Here's the implemenation of the - operator: Graph…
weaver20
  • 21
  • 5
1
vote
1 answer

Function to check if two graphs are complements

I'm trying to write a function which will take two graphs as parameters and return true if they are complement, otherwise false. I figured graphs are complement if inverse of one matches the other that's the approach I tried using. I built my…
Fatima
  • 61
  • 7
1
vote
2 answers

How to get the bipartite complement graph in networkx/python?

I have bipartite graph and I would like to extract the bipartite complement of this graph. This is the G' graph explained in this link…
anthonya
  • 565
  • 2
  • 6
  • 15
1
vote
1 answer

NetworkX: Line graph and complement of it

I have to generate and draw a line graph and complement of for a second graph that i load from .txt file as a adjacency list. I've already tried many ways, but i'm getting only errors. So far no progress... import numpy as np import networkx as…
teddy
  • 51
  • 5
1
vote
1 answer

What is the purpose of this C code?

I was looking over the source code for the "tfind" function from the "search.h" C library and I stumbled upon this line: #define DEREFNODEPTR(NP) (node)((uintptr_t)(*(NP)) & ~((uintptr_t) 0x1)) This is how it's used: /* Find datum in search…
1
vote
1 answer

Decimal to binary: two's complement, better expression for negatives

When I give for example: -2 or -8, I get 110, 11000. But I want to get 10, 1000, because it must use the minimum binary numbers. So I have to use another way to the negative ones. I tried to swap 1 and 0 until I reach LSB 1, but I can't find a…
giorgosan
  • 67
  • 1
  • 1
  • 7
1
vote
1 answer

Fuzzy Logic . How to get the complement

i came across the following fuzzy logic example about fuzzy logic. Representing Age Problem 2-1. Fuzzy sets can be used to represent fuzzy concepts. Let U be a reasonable age interval of human beings. U = {0, 1, 2, 3, ... , 100} Solution 2-1. This…
user437329
1
vote
4 answers

idiomatic way to construct the complement of an array in C

I'm writing a function that gets passed a pointer to an array of length 4. This array will contain integers 0 <= x <= 52 and I would like to construct an array of length 48 with every integer from da kine that's not in the passed in array. In python…
aaronasterling
  • 68,820
  • 20
  • 127
  • 125
1
vote
2 answers

display the 16 bits for the integer

i need your help , here is a part of my code but there is a problem that i cant solve . Plese help me; This is what i have done for now , i can get positive integer in 16 bits binary form ` Console.WriteLine("Enter an integer :…
SNYLMZ
  • 25
  • 1
  • 9
1
vote
0 answers

Addition of 2 signed numbers saved in 32 bit registers.. what's the carry flag and the result?

Lets say we have the following 2's complement values saved in 32 bit registers (A and B): 7FFFFFF0 and 0000002F, and we wanted to add them both then add binary 1 and save them in a different register(C)... what is the result? and what will the carry…
Josh Aston
  • 11
  • 2
1
vote
1 answer

Finding the complement of a DFA structure

So I'm working on a method that converts a dfa to it's complement. The complement rejects all strings the dfa accepts, and accepts all strings thee dfa rejects. To do this I am supposed to follow this algorithm: "First add an explicit dead state and…
Jake Senior
  • 223
  • 4
  • 11
1
vote
1 answer

Construct a DFA of the language L = { L1 \ L2 }

How can I construct a DFA of the language L = { L1 \ L2 } The DFA's of L1 and L2 are given, but how can I "substract" one DFA from another? Is this somehow possible with the relative complement http://en.wikipedia.org/wiki/Complement_(set_theory)…
jannnik
  • 102
  • 1
  • 13