Category Archives: Engineering

Learn Recursion – Day 1

Lets review some recursion types.

  • Tail Recursion: A call is tail-recursive if nothing has to be done after the call returns. I.e. when the call returns, the returned value is immediately returned from the calling function. More simply, tail recursion is when the recursive call is the last statement in the function. See Tail Recursion.
  • Head Recursion: A call is head-recursive when the first statement of the function is the recursive call.
  • Middle or Multi Recursion: A call is mid-recursive when the recursive call occurs in the middle of the function. I.e. there are other statements before and after the recursive call. If one or more of these statements is another recursive call, then the function is multi-recursive. There is no essential difference between Head Recursion, Middle Recursion and Multi Recursion from the standpoint of efficiency and algorithm theory.
  • Mutual Recursion: Function X and Y are called mutually-recursive if function X calls function Y and function Y in turn calls function X. This is also called indirect recursion because the recursion occurs in two steps instead of directly. See Mutual Recursion.
Advertisements

Playing with Groovy – Tutorial 1

Groovy!Ā  Yes šŸ™‚ , although there are so many languages running on JVM, but the reason i choosed groovy , so that i can effectively write Java EE build automation scripts in Gradle.Ā  Well dont need to confuse yourself with #gradle , #groovy #jvm etc… We are here to explore Groovy.

Groovy is

Object Oriented Scripting Language.

A Loosely Typed Language i.eĀ there is no need to define the data-types for the variables and for the return type of the methods.

Provides the ability to statically type check and statically compile your code for robustness and performance … etc

Ability to Implicit Return

 

SupportsĀ Default Parameters , if u dont pass the parameter , the default value of the parameter will be utilized.

 def setPrice(price = 100.00){
    this.price = price
}


Well there are so many pros we can discuss about groovy , lets start our development with downloading Groovy

 

 

References