wi fi – How to hide your SSID from apps / keep your Android apps from finding your Wifi SSID?

As far as I know, all android apps are able to scan nearby / available Wifi networks. They can either get a list of nearby SSIDs, or at least they can get the SSID of the Wifi you are currently on. Correct? I remember the “get wifi scan results” unrevokable permission from some time ago (stoppable only if you were rooted and had xposed framework) (Also, exhibit B: Google, SkyHook, and Apple SSID databases).

This means that even if you are on a VPN, even if you turn off wifi scanning, even if you turn off location services and take out your sim card, even if you stop broadcasting your router’s wifi SSID, your apps will be able to know what wifi SSID you are currently on.

This means that an attacker (read: the surveillance capitalism 🙂 ), can figure out if/when I am home, and which other devices that are online have used the same SSID. E.g. all my family’s banking apps will know where my family members congregate and change my insurance score, or other “insert dystopian scenario here”.

Considering what I described, I don’t think there is any wiggle room for you to ever hide your real location from a bad (state, hacker) actor. Am I wrong? Can I hide my SSID from the apps that are on my phone?

I can’t believe there aren’t any hits on this on the internet.

(PS: obviously, the point of the question is not whether or not I am paranoid, the question is whether this is technically solvable)

complexity theory – Finding the Big-O and Big-Omega bounds of a program

I am asked to select the bounding Big-O and Big-Omega functions of the following program:

void recursiveFunction(int n) {
    if (n < 2) {
        return;
    }

    recursiveFunction(n - 1);
    recursiveFunction(n - 2);
}

From my understanding, this is a Fibonacci sequence, and according to this article here, https://www.geeksforgeeks.org/time-complexity-recursive-fibonacci-program/, the tight upper bound is $1.6180^n$. Thus, I chose all the Big-O bounds >= exp(n) and all the Big-Omega bounds <= exp(n). Below are the choices:

O(1)
O(log n)
O(n)
O(n^2)
O(exp(n))

Om(1)
Om(log n)
Om(n)
Om(n^2)
Om(exp(n))

The answer choices I selected:

O(n^2)
O(exp(n))

Om(1)
Om(log n)
Om(n)
Om(n^2)
Om(exp(n))

However, it was alerted that a few of my answers were incorrect (not sure which of them). This seems strange, considering that this recursive function mimics the calls of a fibonacci sequence which has a Big-Theta exponential time complexity.

ag.algebraic geometry – Finding Pythagorean Triples, with a Conjecture

A right triangle with integer side lengths ($a , b , c$ where $a < b < c$)
can be found (to a certain degree) with the inner radius ($r$), the formulas for the area of a triangle and Pythagoras theorem.

We use these to find a relationship between $r$ and the sides of $a$ and $b$.

$a^2 + b^2 = c^2$

$a^2 = c^2 – b^2$

$a^2 = (c + b)(c -b)$

We now can sub 2 expressions that are equivalent to $c + b$ and $c- b$ into the theorem:

Inner radius formula:

$r = ( a + b – c)/2$

$2r = a + b – c$

$2r – a = b – c$

$a – 2r = c – b$

Inner radius multiplied by semi perimeter formula (A formula for area in right triangles):

$ ab/2 = r (a + b + c)/2$

$ ab = r(a + b + c)$

$ab/r = a + b + c$

$ab/r – a = b + c $

Now we can substitute for $c – b$ and $b + c$.

$a^2 = (ab/r – a)(a – 2r)$

which when rearranged is:

$b=frac{2rleft(a-rright)}{a-2r}$

If we substitute in any value of $a$ we can create a function in terms of $b$ and $r$ where $b = b(r)$

For example, lets write this for the Pythagorean triple, where $a = 3.$

$b(r) = 2r(3 – r)/ 3 – 2r$,

We can conjecture that there is only 2 at most positive integer values of $b$ where $r$ is also an integer within the domain of $0 < r < a/2$, which means we can find solutions for both $b$ and $r$ by graphing.

https://www.desmos.com/calculator/zzxbryrahc

Note: If you look at when $r$ is $1$, you’ll see that $b$ is $4$, which is true in the case of a Pythagorean triple with side lengths of ($3,4,5$).

My question is if there’s a way to decrease the number of possibilities more than just $ 0 < r < a/2$ as this would become difficult without the use of a graphing calculator for larger Pythagorean triples, Any other way to improve on this would be much appreciated.

algorithms – Finding redundant edges on a maximum matchings in bipartite graph

Given a bipartite graph, I need to suggest an algorithm that finds the redundant edges.
A redundant edge is an edge that both the graph with it, and the graph without it have the same size of maximum matchings.

My algorithm is as follows:

  1. Connect source and sink nodes
  2. Set $c(e)=1$ for all $(s,v_1),(v_1,v_2),(v_2,t)space|space{s,v_1,v_2,t}in V$.
  3. Run Edmonds-Karp algorithm on the graph
  4. Look at the last residual network, all the backward edges are the redundant edges
  5. Flip the direction of the edges on the last residual graph, set the capacities to 0 and run Edmonds-Karp again.
  6. Look at the last residual network, and take the backward edges again

We’ll end up with a list of edges, that if we remove one of them we still get a maximum matchings of the same size.

Is my algorithm sufficient enough?

Finding nth derivative of $frac{1}{x^4+4}$

I am supposed to find the nth order derivative of:
$$frac{1}{x^4+4}$$

I tried to resolve into partial fractions. But it didn’t work out for me. I am a beginner in this subject. Please help.

Finding probability when I have a population and a randomly generated population

If I have a total starting population of 4000 students and 3% of those students are African American. What is the probability of me selecting 100 students at random and getting 30 of them to be of that 3% African American population?

real analysis – Finding $Omega$ such that the 1-form $Omega^2 omega$ is $L^2$ orthogonal to conformal killing vector fields on $S^2$

Consider the space $mathcal{A}$ of functions $Omega$ such that $Omega^2 gamma_0$ is isometric to the round sphere, where $gamma_0$ is the round sphere. (so $Omega^2 gamma_0$ is of constant curvature 1). Note that this is related to the lack of uniqueness of the uniformization theorem. Also, there is a natural 1-1 correspondence between $mathcal{A}$ and Mobius transformations of the sphere (which is a 6-parameter family of conformal diffeomorphisms of the round sphere). That correspondence is defined in the following way: for each Mobius transformation $f$, it corresponds to $Omega in mathcal{A}$ satisfying, $f^*(gamma_0) = Omega^2 gamma_0$.

Consider the space conformal killing vector fields on the round sphere, which make a 6-dimensional vector space.

Given an arbitrary 1-form $omega$ on $S^2$, does there exist $Omega in mathcal{A}$ such that $Omega^2 omega$ is $L^2$ orthogonal to conformal killing vector fields? (which means that $int_{S^2} Omega^2 omega_i W^i = 0$ for all conformal killing vectorfields $W$).

path finding – Java Game: A* Algorithm (searching only cells in front of character)

Game Type: grid tile map that is turned based

Directions allowed: Left, Forward, Right
(to reverse directions you must either use two lefts or two rights) – both left and right moves diagonal but change the face of the ship depending on original face)

Slots: Depending on ship size there are a certain number of slots for that particular ship for user to enter to allow the ship to move that many spots per turn (ie. 3 slots == 3 moves per turn)

Example:

Start Position: 2,2

Start face: North

Move Placed: Left

End Result: Position: 1,3 ; Face: West


Problem: algorithm uses all 8 tiles for path finding; but should only look for the tiles that are in front (depends on ship face)

Pathfinding calculation:

    private Comparator<Node> nodeSorter = new Comparator<Node>() {

        @Override
        public int compare(Node n0, Node n1) {
            if(n1.fCost < n0.fCost) return 1;
            if(n1.fCost > n0.fCost) return -1;
            return 0;
        }
        
    };

    public List<Node> findPath(Position start, Position goal){
        List<Node> openList = new ArrayList<Node>();
        List<Node> closedList = new ArrayList<Node>();
        Node current = new Node(start, null, 0, start.distance(goal));
        openList.add(current);
        while(openList.size() > 0) {
            Collections.sort(openList, nodeSorter);
            current = openList.get(0);
            if(current.position.equals(goal)) {
                List<Node> path = new ArrayList<Node>();
                while(current.parent != null) {
                    path.add(current);
                    current = current.parent;
                }
                openList.clear();
                closedList.clear();
                return path;
            }
            openList.remove(current);
            closedList.add(current);
            for(int i = 0; i < 9; i++) {
                if (i == 4)continue;
                int x = current.position.getX();
                int y = current.position.getY();
                int xi = (i % 3) - 1;
                int yi = (i / 3) - 1;
                int at = context.getMap().getTile(x + xi, y + yi);
                if(at == 1 || at == 2) continue; // ignore rocks
                Position a = new Position(x + xi, y + yi);
                double gCost = current.gCost + current.position.distance(a);
                double hCost = a.distance(goal);
                Node node = new Node(a, current, gCost, hCost);
                if(positionInList(closedList, a) && gCost >= node.gCost) continue;
                if(!positionInList(openList, a) || gCost < node.gCost) openList.add(node);
            }
        }
        closedList.clear();
        return null;
    }
    
    private boolean positionInList(List<Node> list, Position position) {
        for(Node n : list) {
            if(n.position.equals(position)) return true;
        }
        return false;
    }

Implementation:

@Override
    public void calculateRoute() {
        Position destination = new Position(3,3); // replace with cluster
        if(this.equals(destination)) {
            return;
        }based 
        path = context.getPlayerManager().findPath(this, destination);
        VesselFace face = getFace();
        if(path != null) {
            if(path.size() > 0) {
                int numberOfMoves = getVessel().has3Moves() ? 3 : 4;
                Position currentPosition = this.copy();
                for(int slot = 0; slot <= numberOfMoves; slot++) { //moves to enter
                    int positionIndex = (path.size() - 1) - (slot); //subtract slot to allow multiple moves
                    if(positionIndex < 0 || path.size() < slot) { // make sure it doesn't count too far
                        return;
                    }
                    Position pos = path.get(positionIndex).position;
                    Position left = MoveType.LEFT.getFinalPosition(currentPosition, face);
                    Position right = MoveType.RIGHT.getFinalPosition(currentPosition, face);
                    Position forward = MoveType.FORWARD.getFinalPosition(currentPosition, face);
                    if(left.equals(pos)) {
                        currentPosition.add(left.getX() - getX(), left.getY() - getY());
                        getMoves().setMove(slot, MoveType.LEFT);
                        switch(face) {
                            case NORTH:
                                face = VesselFace.WEST;
                                break;
                            case SOUTH:
                                face = VesselFace.EAST;
                                break;
                            case WEST:
                                face = VesselFace.SOUTH;
                                break;
                            case EAST:
                                face = VesselFace.NORTH;
                                break;
                        }
                    }else if(right.equals(pos)) {
                        currentPosition.add(right.getX() - getX(), right.getY() - getY());
                        getMoves().setMove(slot, MoveType.RIGHT);
                        switch(face) {
                            case NORTH:
                                face = VesselFace.EAST;
                                break;
                            case SOUTH:
                                face = VesselFace.WEST;
                                break;
                            case WEST:
                                face = VesselFace.NORTH;
                                break;
                            case EAST:
                                face = VesselFace.SOUTH;
                                break;
                        }
                    }else if(forward.equals(pos)){
                        currentPosition.add(forward.getX() - getX(), forward.getY() - getY());
                        getMoves().setMove(slot, MoveType.FORWARD);
                        switch(face) {
                            case NORTH:
                                face = VesselFace.NORTH;
                                break;
                            case SOUTH:
                                face = VesselFace.SOUTH;
                                break;
                            case WEST:
                                face = VesselFace.WEST;
                                break;
                            case EAST:
                                face = VesselFace.EAST;
                                break;
                        }
                    }
                }
            }
        }
    }

I use the switch statement and currentPosition.add() method so that when you place 3 moves for that particular turn; it knows where it should end up. Probably not best practice.

Statement that adds a move to the particular slot

getMoves().setMove(slot, MoveType.FORWARD);

Tiles that should be checked every turn based on ship face:

enter image description here

r – Finding rowwise minimum and column index in a tibble

I have the following tibble:

> df <- tibble(
     ID = LETTERS(1:4),
     a  = c(1,5,9,8),
     b  = c(5,9,8,2),
     c  = c(5,4,5,5)
)

> df
# A tibble: 4 x 4
  ID        a     b     c
  <chr> <dbl> <dbl> <dbl>
1 A         1     5     5
2 B         5     9     4
3 C         9     8     5
4 D         8     2     5
> 

What I want is to get the rowwise minimum of columns a:c and also the column index from this minimum.
The output tabel should look like this:

# A tibble: 4 x 6
  ID        a     b     c   Min Col_Index
  <chr> <dbl> <dbl> <dbl> <dbl>     <dbl>
1 A         1     5     5     1         1
2 B         5     9     4     4         3
3 C         9     8     5     5         3
4 D         8     2     5     2         2

I don’t want to use rowwise()!

Thank you!

algorithms – Finding largest disjoint subtrees spanning nodes

I have a taxonomy (tree) of product categories. To each leaf product category, I have assigned a shop department where the products of a given category can be found.

Now for each department, I would like to find the smallest number of the largest subtrees in the taxonomy.

For instance, in the example below leaf nodes have been assigned one of two departments $A$ and $B$.

example

The expected solution would be: $A$ has two subtrees, namely $x_2$ and $x_7$, $B$ has one subtree $x_4$.

The solution where $A$ has $x_1$ subtree is wrong because $x_1$ is the ancestor of nodes that belong to another department.

The solution where $A$ has $x_3$ and $x_7$ subtrees is wrong because we want the biggest subtrees possible.

Is it a known problem?

Is there a solution for it?