## Upper bound for chromatic number (\$chi(G) leq Delta(G)+1\$)

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

## 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){

//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 numbers how many times it occured in arraylist
Lhappenitems(0)=Lhappen2;

//adding in total number it occur in an arraylist
//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 numbers how it many times it occurred in arraylist
Nhappenitems(0)=Nhappen2;

//adding in total number it occur in an arraylist
//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

Posted on

## 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.

Posted on

## 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,
):
payload = {"status_code": status_code, "message": message}
if data:
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.

Posted on

## 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 = Gk (elliptic curve scalar multiplication) Or does the whole signature is the Gk ??
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
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?

Posted on

## Sort email by the number of unread messages in gmail web

I would like to sort the email senders by the number of unread messages.

In the web version of gmail, they don’t support this feature as far as I know.

How can I do this?

## 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}$$.

Posted on

## 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) 