Tail recursive saves stack memory. A recursive function is said to be tail-recursive if there is nothing to do after the function returns except returning its value. In this case, instead of allocating a stack frame for each call, the compiler can rework the code to simply reuse the current stack frame, meaning a tail-recursive function will only use a single stack frame as opposed to hundreds or even thousands of stack frame as in the case of regular recursive calls. Also, in a tail-recursive case, with each evaluation of the recursive call, the solution (e.g., a running total) is updated through parameter. A smart compiler can make Tail Recursion as efficient as iteration normally is. We'll see an tail-recursion implementation of Fibonacci at the end of this post. Using Fibonacci as an example, a Fibonacci sequence: [f(0)...f(n)]=[0, 1, 1, 2, 3, 5, 8, 13, ...]
0 Comments
The Dijkstra's Algorithm (shortest route) finds the shortest distance and path from a source to all destination in a directed graph which is defined by a set of vertexes (V) and a collection of edges.
I found the easiest way to understand how Dijkstra's algorithm works is to take a look at this visual explanation below:
This post is a case study of my latest project. The resultant product is a pair of websites designed for new Bitcoin (a crypto-currency) users. I laid the ground work of inbound marketing in September (3 months ago) along with market research and planning. It is not until recently I started the design and development in anticipation of a full rollout planned in the coming year 2014. The websites, bitcoin-tw and bitcoin-en, are partially live and open to the public as of this writing.
Given an array with integers, find the largest sum of continuous subarray. This maximum subarray problem was first posed in 1977. Jay Kadane solved it in linear time (O(n)) in 1988.
The role of product manager is viewed as a business function to maximize ROI in the product, maximize market share, revenue, etc. for business success. Product managers work with engineering and across the business to make sure the software product is well built and defined. I personal think an entrepreneur should be a product manager in his soul with product manager skills. What does a product manager do? A clear thought process helps coders to get to the solutions. This post simply walks you through my thought process of how to implement some very basic data structure - a stack and a queue.
BDD is basically TDD done properly. It is an agile methodology for building a shared understanding of what software to build by discussing using examples. It is a technique that uses a business language to define acceptance criteria. It is about figuring out what to build with an outside-in approach - having conversations, capturing conversations, automating conversations. In other words, first think about what you’re about to write, then think about how you would test the code, before writing it.
BDD is not an agile project framework (e.g. SCRUM) nor a project management approach. |
Categories
All
Archives
May 2020
|