Reference cards (cheat sheets) collection.

Main algorithms to use.

Basic algorithms :

  • Sorting – Merge Sort, Insertion Sort, Quick Sort, Number of inversions
  • Matrix Multiplication (just know the algo if not implement it)
  • Prime Sieving
  • Modular Math including multiplication and division
  • Euclidean Algorithm for GCD, Modular Inverse, Fast Exponentiation
  • Fibonacci number with matrix multiplication
  • Probability distribution and expected value
  • Stats – Mean, Median, Variance, Bayes theorem

Linear data structures and algorithms:

  • Arrays
  • Linked List
  • Stack
  • Queues

Algorithmic techniques:

  • Divide and Conquer – Binary Search, Maximum Subarray
  • Greedy Algorithms – Activity Selection, Huffman encoding
  • Dynamic Programming – Matrix Chain Multiplication, Knapsack,
  • Linear Programming – Variable Maximisation, Linear time sorting
  • String Algorithms – Manacher, LCS, Edit Distance

Typical non-linear data structures:

  • Trees – Binary Tree, General Tree, Lowest Common Ancestor
  • Binary Search Tree – Inorder Traversal, Level order traversal, finding kth largest element, diameter, depth, number of nodes, etc.
  • Heaps – Array Implementation, Heapify, Heap Sort
  • Union Find
  • Hash Table – Linear Probing, Open addressing, Collision avoidance

Graphs:

  • Adjacency List, Adjacency Matrix, Weighted Edge Graphs
  • Basic Traversal algos – Breadth First Search, Depth First Search, etc
  • Shortest Path Finding Algorithm – Dijkstra, Floyd Warshal, Bellman Ford
  • Minimum Spanning Tree – Kruskal’s Algo, Prim’s Algo

Advance Tree and Graph :

  • Balanced Trees – AVL, Red-Black
  • Heavy Light Decomposition, B+ Trees, Quad Tree
  • Advance Graph – Min Cut, Max Flow
  • Maximum Matching – Hall’s Marriage
  • Hamiltonian Cycle
  • Edge Graphs / Line Graphs
  • Strongly Connected Components
  • Dominant Sub-Graph, Vertex Cover, Travelling Salesman – Approx algos

Advance String Algorithms :

  • Knuth Morris Pratt Algorithm
  • Rabin Karp Algorithm
  • Tries and Compressed Tries
  • Prefix Trees, Suffix Trees, Suffix Automation – Ukkonen Algorithm

Advance Math:

  • Fast Fourier Tranformation
  • Primality Testing
  • Computational Geometry – Closest point pair, Voronoi diagram, Convex Hull

General Advance topics :

  • Iterating through all combination / permutation
  • Bit manipulation

Reference cards (cheat sheets) collection.

Java may not be the newest programming language around, but it is still one of the most popular. This is an Object Oriented Programming (OOP) language, which has become a mainstay in most enterprise and home projects.
Here are a few good design principles you should follow:

1. DRY
DRY stands for Don’t Repeat Yourself, which is pretty self explanatory. This means that you shouldn’t be duplicating your code in a program. If a code fragment is appearing in two places, then you would do well to turn it into a method instead of writing the entire fragment again. Lack of duplication helps in easy maintenance of the code.

2. Encapsulation

Whether your project gets bought over or whether you work on it yourself, your code will always change. So, it is good to encapsulate the part of the code that you think will be changed. This makes you code easy to maintain and test.

3. Design Principle

Here you should try and follow an open closed design principle. This means that you classes, functions or methods should be Open so that new functionality can be added easily. The Open Closed Design Principle focuses on this aspect and makes it possible to avoid unauthorised changes to already tested and working code.

4. Single Responsibility Principle (SRP)

According to this principle, a class should be handling a single functionality. In addition, there should be more than one reason for a developer to change a class from what it currently does. For example, if you have multiple functionalities in a class in Java then you might face problems when you are coupling this fake Java.

5. Dependency

The framework that you use already provides you dependence, which means that looking for it a additionally will be a waste of time. You can also use byte code instrumentation as well. Some Aspect Oriented Programming (AOP) framework already does this. Lastly, you can also make the use of proxies.

6. Composition over Inheritance

According to many programmers, composition is more important than inheritance. They say that you should be focusing on the composition of your program than on employing a flexible inheritance structure. This is because composition allows you to change the behaviour of a class at runtime. Interface on the other hand allows you to use polymorphism, providing the flexibility to replace something with better implementation.

7. Liskov Substitution Principle (LSP)

This principle states that you must be able to subtypes for super types. This means that any methods or functions in your program that are making the use of super class types, then they should also be able to work with the sub class. It is in close relation to SRP and the Interface Segregation Principle.

8. Interface Segregation principle (ISP)

This principle tells you to ensure that clients do not implement any interface that it doesn’t use. In Java, an interface has the disadvantage from the design point of view, to implement all methods before the classes can use it;

9. Programming for Interface

A programmer should always be programming for the interface and not for the implementation that will give them flexibility in code. Make use of interface types on variables and return types on methods. In addition, argument types should also be use.

10. Delegate

Delegate the tasks of your program to specific to classes. An example of this would be the equals () and hashCode() method.

We live in a day and age where we tend to evolve each day on all frontiers. So is the field of programming and the languages used by programmers. While Java, C++, JavaScript, PHP, Ruby etc have been there, done that; there are plenty of other languages that are now being increasingly embraced by programmers across the globe for the sheer fact that they offer a little extra to what the majors do. Here are eight such lesser known languages creating quite the storm today.

1.Racket 6.0 - Racket 6.0 : General purpose, multi-paradigm programming language in the Lisp/Scheme family. The platform provides an implementation of the Racket language (including a sophisticated run-time system, various libraries, JIT compiler, and more) along with a development environment called DrRacket written in Racket itself. Used in a variety of contexts such as scripting, general-purpose programming, computer science education, and research.

2.OCaml 4.01 - 2.OCaml 4.01 : Main implementation of the Caml programming language that extends the core Caml language with object-oriented constructs. OCaml’s toolset includes an interactive top level interpreter, a bytecode compiler, and an optimising native code compiler. It has a large standard library that makes it useful for many of the same applications as Python or Perl, as well as robust modular and object-oriented programming constructs that make it applicable for large-scale software engineering.
3.Nimrod 0.9.2 - Nimrod 0.9.2  : Statically typed, imperative programming language that tries to give the programmer ultimate power without compromises on runtime efficiency. This means it focuses on compile-time mechanisms in all their various forms. Consists of a nice infix/indentation based syntax with a powerful (AST based, hygienic) macro system and a semantic model that supports a soft realtime GC on thread local heaps.
4. Julia 0.2.1 - Julia 0.2.1 : High-level dynamic programming language designed to address the requirements of high-performance numerical and scientific computing while also being effective for general purpose programming. Julia’s core is implemented in C and C++, its parser in Scheme, and the LLVM compiler framework is used for just-in-time generation of machine code.
5.Hack 1.0 - Hack 1.0 : Programming language for the HipHop Virtual Machine (HHVM) invented by Facebook. Hack can be seen as a new version of PHP that also runs on the HHVM, but it allows programmers to use both dynamic typing and static typing.
6.Groovy 2.2 - Groovy 2.2 : Object-oriented programming language for the Java platform that is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java Virtual Machine (JVM) bytecode, and interoperates with other Java code and libraries.
7.Egison 3.3.3 - Egison 3.3.3 : Touted as the world’s first programming language that realised non-linear pattern-matching with backtracking. It enables to represent pattern-matching against lists, multisets, sets, trees, graphs and any kind of data types, directly.
8.Clojure 1.6 - Clojure 1.6 : Dialect of the Lisp programming language, Clojure is a general-purpose programming language with an emphasis on functional programming. It runs on the Java Virtual Machine, Common Language Runtime, and JavaScript engines.