“Trees A tree is an

p.135undirectedgraph that isconnectedandacyclic.”

Trees have these properties, quoting from DPV again:

- A tree on
**n nodes has n − 1 edge**s - Any
**connected, undirected**graph G = (V, E) with**|E| = |V| − 1 is a tree**. - An
**undirected**graph is a tree if and only if there is a**unique path between any pair of nodes**.

So after DFS, if any edge satisfies

Time complexity *O(|V|+|E|)* + O(|V|) which finally becomes *O(|V|+|E|)*

For undirected graphs, we can use Depth First Search (DFS) to find the connected component number for each vertex. The runtime is *O(|V|+|E|)*.

Directed graphs can be of two types. Directed Acyclic Graphs (DAG) and General Directed Graphs. DAGs’s do not have cycles. In general directed graphs, cycles may exist.

So, for directed graph what we need to find is called **Strongly Connected Component**. In order to find it, first create a new graph where original edges are in reverse direction.

Next, run DFS on this reverse graph to find postorder numbers and order vertices in descending order. This first node is guranteed to be in a source SCC in the original graph.

Next, starting from the first node above, run DFS and assign component number to each nodes. When all the connected nodes are visited from the first node, move to the second node.

Thus after two rounds of DFS, we can find SCC for a general directed graph.

Based on the DFS, the runtime is *O(|V|+|E|*).

To create a rapidly scalable tech startup business that creates a Blue Ocean of undiscovered demand, one needs to generate one idea, implement, test it, and continually improve. This sounds familiar to the Lean Startup concept. But how does one generate an idea in the first place? Ideas come from life. So if you are looking around what social groups you mix with, you can find problems worth solving. Nick Woodman came up with the idea of GoPro when he faced issues capturing high quality action videos while surfing. So the fact that he was a surfer, gave birth to the idea of his product and the company. The popular social media aggregator site, Walls.io gained momentum as the founder was involved in BarCamp. So these two examples show, you can gain ideas from interaction with people in a domain. However, this is not the only pattern to generate ideas successfully.

Mark Zuckerberg was already a netizen before he started social networking site Facebook. Even prior to that he developed a music matching program. He experimented and built tools. For starters, being skilled means you can build stuff for others while you get money for your skill. That is the traditional consultancy job. That was how Zuckerberg got commissioned by fellow Harvard entrepreneurs to build *A* social networking site which became *The* social networking site. Also to build out the product from an idea takes strong technical and engineering skills at least for the first phase until one is able to secure enough funds to hire an employee. So having a consultancy business helps build those muscles initially. But building a consultancy business with a keen eye on solving the right problem can reveal even bigger opportunities than the immediate project at hand.

Finally, there is Daniel Ek, who built a successful web development consultancy business when he was a teenager which started as he built websites for others for money in an era when building a website was a non trivial coding work. But that is not what he got his idea of Spotify. It was instead from his personal observation that people downloaded pirated music and record companies were losing the fight. He was living in the domain of music and that is what sparked his entrepreneurial brain.

That is the summary. For starters, building a consultancy hustle can help survive the short term and create avenues to your long term aspiration. Just do not be satisfied with the status quo!

]]>So in my solution below, I gradually take a wider step up from checking just one element from the beginning of this infinite array and check if the last value in that window is big enough to capture *x*, which indicates we have covered enough length to capture the first *n-th* values. At each step, I double the window size.

Then when we have found the window withing which either *x* should reside, or we hit None, we run binary search within A[i,j]. The example below assumes x is guaranteed to be in the array.

```
def binary_search(i, j, x):
mid = int((i+j) / 2)
mid_val = A[mid]
ind = None
if mid_val == x:
ind = mid
elif mid_val is None or mid_val > x:
ind = binary_search(i, mid, x)
elif mid_val < x:
ind = binary_search(mid, j, x)
return ind
def find_x_in_infinite_array(A, x):
i = 0
k = 0
while True:
j = i + 2 ** k
j_val = A[j]
if j_val is None or j_val > x:
index = binary_search(i, j, x)
break
i = j
k = k + 1
```

]]>“Too bad! Same old story! Once you’ve finished building your house you notice you’ve accidentally learned something that you really should have known—before you started.”

– Friedrich Nietzsche, Beyond Good and Evil

“if you don’t know where you are going you’ll end up someplace else”

]]>In Reinforcement Learning (RL), there are some key concepts. Let us introduce them through the Hello World example for RL. Imagine you have a robot which does not know how to navigate through a maze. We call this robot an **agent**. The maze is divided into grids.

Your robot can be located in any of the grids at a time. We call these grids **“states”**. The robot takes an “**action**” at a time which makes it move from grid (state) to another grid. The movement is called “**transition**“. Through this transition it receives some sense of how much it is close to the goal. This is what we call as the “**reward**“. The objective of a RL agent is to accomplish the task so that the rewards are maximum.

Since your robot does not know the task of how to navigate through the maze and reach the goal which is getting out of the maze, so it needs to learn the best **“policy”** which is basically which decision it should take at every state.

That’s all for now. We covered the key terms in RL:

- Agent
- State
- Action
- Transition
- Rewards
- Policy

Next, we will introduce the famous **Bellman-Equation** for Markov Decision Process.

Since early on, I was a hardworking student. So my parents continued investing in my education. When I was in grade 8, I convinced my parents to let me go to Dhaka Residential Model College for grade 9-10 because I thought my father will get transferred for his job away from the capital city and the family would have to move as well. I anticipated that changing schools at this time could hamper my Secondary School Certificate exam, which was the first crucial academic exam for a student’s career in Bangladesh. It was a very expensive school to be in also the admission test was tough. Anyway, I got the admission form and took the admission test studying all alone. I was scared I will not be able to compete against the more well prepared and tutored competitors to get one of those limited seats. I did not even have a tutor outside of school when I was in grade 8. But I made it in the test. I learned a very important lesson in my life: ** Limited resources does not always mean limited capabilities**. After the admission, my parents paid the hefty admission fees. I still remember it was around BDT10390. For comparison BDT 10390 is around USD125. But my public school in grade 8 only cost us around BDT 25 in 2002. Another lesson learned:

Fast forward, I got through undergrad with very minimal expense at the apparently most prestigious university in Bangladesh. Since I proved my potential through the super selective admission test, I had it for almost free. Same lesson applies: **show the potential, people will invest in the future. **

Up next, my professor at UConn invested in my MS degree studies because he believed I would be able to produce some research outcomes for his project. So I had the amazing opportunity to work as a Graduate Research Assistant and my tuition was covered and also I received the monthly stipend. It would be quite expensive to study in the USA. Same lesson: **if you can convince that future is amazing, you can marshal resources. **

Right now my current employer Ford Motor Company is providing the tuition for my second MS. My former boss believed I can combine domain knowledge in Mobility, Data Science and Computer Science to build amazing analytic software in the future. Again, I do not have to pay the tuition fees. **Convincing matters. **

So, now what about work and career? This is the phase I am working on right now. I am building my technical skills and developing people skills. This part is about building the **competence and credibility**. Up next, I will need to develop some proposals for some projects which has the potential to create an outsize impact in the future. It will take insight, foresight, and research. At this point, it will require convincing the company to gain resources including a team and a budget, and you know the formula by now: **pitch for the future** **with competence and credibility, then resources will never be a problem**.

So this is my formula for becoming a change maker, leader, entrepreneuer/intrapreneur, whatever you name it. But this is the only formula I learned from my life. Even for personal life, my beautiful and extremely supportive wife somehow had to be convinced that our future together will be significantly better than our futures otherwise. So that is also kind of a soft-pitch.

I don’t know yet if my idea is future-proof, but it worked out pretty well so far! If we think like this, we have all been running our own startups: ourselves, and all of us have been pitching for VC funding throughout our lives!

Just summarizing the tools for connecting to Hadoop and running geospatial processing on a large dataset. I am working on a ~100 GB Hive Table which is just a small subset of the original dataset

- http://geospark.datasyslab.org/
- https://pypi.org/project/geopyspark/
- https://github.com/Esri/gis-tools-for-hadoop/wiki
- Kinetica GPU Database – Graph solver and Match solver
- PySpark python libraries
- Spatial Hadoop
- Alteryx – Using Connect-in-DB function to connect to Hadoop