i am new in graph theory. I saw in some text book this "obvious" upper bound $$chi(G) leq Delta(G)+1$$ i can’t see how to demonstrate it

# Tag: number

## java – help me solve it i want to find the occurrence of number in an array and a combination of same element into an arraylist

I am trying to find the combination of same numbers in an array in java e.g i have number in an array e.g numbers{1,2,2,2,1,1,1,2,2,2,1,1,2,2,2,1,1,1,2,2,1} .So i want the program to check all combinations of number that occurred in a sequence of order only like 1, or 2,2,2 or 1,1,1 or 2,2,2 then it will check how many times did 2 or 1 occur so the occurred number will be stored in an arraylist. In that case first 1 occurred 1 time then 2 occured 3 times then 1 occurred 3 times then 2 occurred 3 times and so on it will show how elements are arranged in an array .i have wrote a code but it is not working in java as i want it to

public class Main {

private static ArrayListPlistItem=new ArrayList();

private static ArrayListNlistItem=new ArrayList();

private static ArrayListPwillhappen=new ArrayList();

private static ArrayListNNhappen=new ArrayList();

private static ArrayList LhappenList=new ArrayList();

private static ArrayList NhappenList=new ArrayList();

private static ArrayList LhappenListTotal=new ArrayList();

private static ArrayList NhappenListTotal=new ArrayList();

private static int Lhappen=0;

private static int Lhappen2=0;

private static int Nhappen=0;

private static int Nhappen2=0;

private static int () items ={1,2,2,2,1,1,1,2,2,2,1,1,2,2,2,1,1,1,2,2,1};

private static int () Nhappenitems =new int(1);

private static int () Lhappenitems =new int(1);

public static void main(String ()args){

PlistItem.add(1);

NlistItem.add(2);

//comparing elements from an array which with an arraylist number

for(int y=0; y<items.length; y++){

if(PlistItem.get(0)==items(y)){

//counter to count how many times 1 occurred

Lhappen++;

//counter to count how many times 1 occurred

Lhappen2++;

//adding the counter in arraylist

Pwillhappen.add(0, Lhappen);

//adding the numbers how many times it occured in arraylist

Lhappenitems(0)=Lhappen2;

//adding in total number it occur in an arraylist

LhappenListTotal.add(0,Pwillhappen.get(0));

//setting the counter into 0

Nhappen=0;

}else if(NlistItem.get(0)==items(y)){

//counter to count how many times 2 occurred

Nhappen++;

//counter to count how many times 2 occurred

Nhappen2++;

//adding the counter in arraylist

NNhappen.add(0,Nhappen);

//adding the numbers how it many times it occurred in arraylist

Nhappenitems(0)=Nhappen2;

//adding in total number it occur in an arraylist

NhappenListTotal.add(0, NNhappen.get(0));

//setting the counter into 0

Lhappen=0;

}

}

System.out.println(” RESULTS ” );

System.out.println(“——————————————————————————–“);

System.out.println(“1 occurrence total “+ Nhappenitems(0) +” times”);

System.out.println(“2 occurence total “+ Lhappenitems(0) +” times”);

System.out.println(“——————————————————————————–“);

for(int i=0; i<LhappenListTotal.size(); i++){

System.out.println(” combination of 1’s occurred “+ LhappenListTotal.get(i) +” times”);

}

System.out.println(“——————————————————————————–“);

for(int i=0; i<NhappenListTotal.size(); i++){

System.out.println(“combination of 2’s occurred “+ NhappenListTotal.get(i)+” times”);

}

}

}

RESULTS

1 occurrence total 11 times

2 occurence total 10 times

combination of 1’s occurred 1 times

combination of 1’s occurred 3 times

combination of 1’s occurred 2 times

combination of 1’s occurred 1 times

combination of 1’s occurred 2 times

combination of 1’s occurred 1 times

combination of 1’s occurred 3 times

combination of 1’s occurred 2 times

combination of 1’s occurred 1 times

combination of 1’s occurred 1 times

combination of 2’s occurred 2 times

combination of 2’s occurred 1 times

combination of 2’s occurred 3 times

combination of 2’s occurred 2 times

combination of 2’s occurred 1 times

combination of 2’s occurred 3 times

combination of 2’s occurred 2 times

combination of 2’s occurred 1 times

combination of 2’s occurred 3 times

combination of 2’s occurred 2 times

combination of 2’s occurred 1 times

my code when i run it is showIng as above results instead i want my results to be as below so help me to solve the code to produce the results as below it show produce the result same as the elements how they are arranged in an array.. items ={1,2,2,2,1,1,1,2,2,2,1,1,2,2,2,1,1,1,2,2,1};

RESULT

combination of 1’s occurred 1 times

combination of 1’s occurred 3 times

combination of 1’s occurred 2 times

combination of 1’s occurred 3 times

combination of 1’s occurred 1 times

combination of 2’s occurred 3 times

combination of 2’s occurred 3 times

combination of 2’s occurred 3 times

combination of 2’s occurred 2 times

## Estimate the number of host computers on the private network by port scanning

If we have a private network connected to the Internet with NAT, how can an attacker estimate the number of host computers in network using port scanning?

For both possible modes, the attacker inside and outside the private network.

## python – How can I reduce the number of parameters in this function?

I’ve been reading *Clean Code* by Robert C. Martin (Uncle Bob) which states that functions should have as few parameters as possible. Ideally zero.

The book suggests that three or more parameters is too many for a function.

I am now trying to implement this practice into my own code and I’m trying to figure out how to reduce the number of parameters in the following function

```
def json_return(
status_code
message
data = None,
headers = None,
):
payload = {"status_code": status_code, "message": message}
if data:
payload.update({"data": data})
response = jsonify(payload), status_code, headers
return response
```

This is a function used to generate a JSON response. I’m having troubling understanding how to structure this function in a way that it takes fewer parameters.

One thought I had was to make this into a `Response`

class but I would still need to initialize that class with these same arguments as far as I can tell.

How can I better organize this function so that it takes fewer arguments. The solution can be splitting it into multiple functions, a larger class or anything else (it isn’t restricted to keeping it as one function).

**I know these principals are controversial. I understand that and still want to learn how best to implement them in my code.**

## signature – Random Number In R Value , what is it actually, is it the same as Nonce in the blocks

I wonder about the random number in R value …

if i am right , the R value is First part of the script signature which is combined of two parts (r,s)

r = G*k (elliptic curve scalar multiplication) Or does the whole signature is the G*k ??

So r , is a multiplication of random number ( k ) times G (elliptic curve scalar multiplication )

while

r = xcoordinate(R) , is just the first part of the ( r,s )

I read an article the most repeated R values in transactions is

0x00000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63

while G is the Double of this point means that the random number is (1/2)

so R value Is simply is simply calculated by multiplying any number by G ???

and they do call it nonce , so is it the same nonce shown in blocks ? that is already public ?

or it is another nonce ?

## Determine the number of reachable states in a subset construction?

Is there a method to determine the number of reachable states in the subset construction of a NFA to a DFA without having to construct the entire DFA?

## minimum number of edges that should be added to an undirected graph to make it a tree

Your first guess is correct. Sometimes there is more than one way to write the same solution.

Clearly, if there are $k$ connected components you’ll need exactly $k-1$ edges to connect them (without forming any cycle).

On the other hand, a tree with $n$ nodes must have exactly $n-1$ edges, so if the graph is acyclic and already has $m$ edges, then it is missing $n-1-m$ edges.

Regarding the example: the given graph has $n=10$ vertices, $m=6$ edges, and $k=4$ connected components (not 3), so the answer is $3=k-1=n-m-1$. The sets of vertices in each connected component are ${1,2,8}, {3}, {4, 6, 10}$, and ${5, 7, 9}$.

## Why can i add /page/674874 (or any number) to a URL and it still pulls up that page?

I have noticed that on any WordPress site you can add /page/7863/ (or any number) to any page url and it still shows that page and not a 404. Why is that? (Asking because my SEO company sends reports that show /pages/(number)/ as different pages even though they are the same page just different number as shown in screenshot)

## External link number

Does it matter whether a page externally links to 1 or 10 pages, from the POV of the pages linked? Would they somehow receive lesser SEO benefits as in less visibility or link juice (even though I think that term is now obsolete)