Library

Course: Algorithmic Problems and Interview Questions in Java

Algorithmic Problems and Interview Questions in Java

  • Life Time Access
  • Certificate on Completion
  • Access on Android and iOS App
About this Course

This course is about the fundamental concepts of algorithmic problems, focusing on backtracking and dynamic programming. As far as I am concerned these techniques are very important nowadays, algorithms can be used (and have several applications) in several fields from software engineering to investment banking or R& D.

Section 1:

  • what are recursion and recursive methods
  • linear and binary search
  • tower of Hanoi problem

Section 2:

  • what are selection algorithms
  • quickselect algorithm
  • the secretary problem

Section 3:

  • what is backtracking
  • n-queens problem and Hamiltonian cycle problem
  • knight's tour problem
  • Sudoku game

Section 4:

  • what is dynamic programming
  • knapsack problem
  • coin change problem and rod cutting problem

Section 5:

  • bin packing problem
  • closest pair of points problem

Section 6:

  • top interview questions (Google, Facebook and Amazon)

The first chapter is about backtracking: we will talk about problems such as n-queens problem or hamiltonian cycles, coloring problem and Sudoku problem. In the second chapter we will talk about dynamic programming, theory then the concrete examples one by one: fibonacci sequence problem and knapsack problem.

In each section we will talk about the theoretical background for all of these algorithms then we are going to implement these problems together from scratch in Java.

FINALLY YOU CAN LEARN ABOUT THE MOST COMMON INTERVIEW QUESTIONS (Google, MicroSoft, EPAM etc.)

Thanks for joining the course, let's get started!

Basic knowledge
  • Students should have some basic programming background (loops, classes, objects etc.)
What you will learn

You will understand the following concepts:

  • Recursion
  • Backtracking
  • Search algorithms: linear and binary search
  • Dynamic programming
Curriculum
Number of Lectures: 65
Total Duration: 07:19:14
Introduction
  • Introduction  
Recursion
  • Recursion introduction  
  • Adding numbers: iteration vs recursion  
  • House building problem  
  • Factorial function  
  • Euclidean algorithm - greatest common divisor  
  • Linear and binary search introduction  
  • Linear and binary search implementation  
  • Towers of Hanoi problem introduction  
  • Tower of Hanoi problem implementation  
Selection Algorithms
  • Selection algorithms introduction  
  • Quickselect introduction - Hoare algorithm  
  • Quickselect simulation  
  • Quickselect implementation  
  • Advanced selection - median of medians, introselect  
  • Online selection - the secretary problem  
Backtracking
  • Backtracking introduction  
  • N-queens problem introduction  
  • N-queens problem implementation I  
  • N-queens problem implementation II  
  • Hamiltonian cycle introduction  
  • Hamiltonian cycle illustration  
  • Hamiltonian cycle implementation I  
  • Hamiltonian cycle implementation II  
  • Coloring problem introduction  
  • Coloring problem implementation I  
  • Coloring problem implementation II  
  • Knight's tour introduction  
  • Knight's tour implementation I  
  • Knight's tour implementation II  
  • UPDATE: Knight's Tour  

    Hi! Unfortunately I made a mistake in the implentation: in the for loop we consider all the possible moves so instead of boardSize.length we should use xMoves.length (so the number of possible moves)

    public boolean solveProblem(int stepCount, int x, int y) {
    
    		if (stepCount == Constants.BOARD_SIZE * Constants.BOARD_SIZE) {
    			return true;
    		}
    
    		for (int i = 0; i < xMoves.length; ++i) {
    
    			int nextX = x + xMoves[i];
    			int nextY = y + yMoves[i];
    
    			if ( isValidMove(nextX, nextY) ) {
    
    				this.solutionMatrix[nextX][nextY] = stepCount;
    
    				if ( solveProblem(stepCount + 1, nextX, nextY) ) {
    					return true; // good solution, keep going
    				}
    
    				this.solutionMatrix[nextX][nextY] = Integer.MIN_VALUE;
    			}
    		}
    
    		return false;
    }
    

    Sorry for the inconvenience!

  • Maze problem introduction  
  • Maze problem implementation I  
  • Maze problem implementation II  
  • Sudoku introduction  
  • Sudoku implementation I  
  • Sudoku implementation II  
  • NP-complete problems  
Dynamic Programming
  • Dynamic programming introduction  
  • Fibonacci numbers introduction  
  • Fibonacci numbers implementation  
  • Knapsack problem introduction  
  • Knapsack problem example  
  • Knapsack problem implementation I  
  • Knapsack problem implementation II  
  • Coin change problem introduction  
  • Coin change problem example  
  • Coin change problem implementation  
  • Rod cutting problem introduction  
  • Rod cutting problem example  
  • Rod cutting problem implementation  
  • UPDATE: rod cutting implementation  
  • Subset sum problem introduction  
  • Subset sum problem example  
  • Subset sum problem implementation  
Other Algorithmic Problems
  • Bin packing problem introduction  
  • Bin packing problem implementation  
  • Closest pair of points problem introduction  
  • Closest pair of points problem implementation  
Course Materials (Slides & Source Code)
  • Download course materials  
Interview Questions
  • Palindrome problem solution  
  • Two eggs problem solution I  
  • Two eggs problem solution II  
  • Duplicates in an array problem solution  
  • Anagram problem solution  
Reviews (0)