Posts

Order complexity of a pairing function

Image
0 I have a code that involves a 2 to 1 pairing of numbers. The code for this is function [ A ] = CantorPairing( B ) [~, b] =(size(B)); %b=sqrt(b); k=1; A=zeros(1,b/2); for i=1:2:(b) if( B(i)< B(i+1)) A(k)= B(i)+(B(i+1))^2; else A(k)= (B(i))^2+B(i)+B(i+1); end k=k+1; end This is a matlab code that i am implementing. What this code does is, it pairs the adjacent elements of an array B depending on which is greater. So for an n size array the number of elements it returns is n/2. I have a few questions for this code. Since I am new to computer science, I don't think this is a very efficient code in MATLAB, can I optimize this code. What is the order complexity of...

How can I open a range of ports in ubuntu using (g)ufw

Image
32 9 I have to open up a group of ports. Adding the single ports to (g)ufw was easy enough but I can't work out how to open the range 11200 - 11299 . How do I do that? firewall ufw gufw share | improve this question edited Apr 28 '17 at 3:04 user383919 asked Oct 14 '10 at 10:00 Pieter Breed 335 3 5 9 add a comment  |  ...