Featured Article

Minimax Algorithm in Game Theory | Set 3 (Tic-Tac-Toe AI – Finding optimal move)

Prerequisites: Minimax Algorithm in Game Theory, Evaluation Function in Game Theory Let us combine what we have learnt so far about minimax and evaluation function to write a proper Tic-Tac-Toe AI (Artificial Intelligence) that plays a perfect game. This AI will consider all possible scenarios and makes the most optimal move. Finding the Best Move… Read More »

Featured Article

Know Your Sorting Algorithm | Set 1 (Sorting Weapons used by Programming Languages)

Ever wondered how sort() function we use in C++/Java or sorted() in Python work internally? Here is a list of all the inbuilt sorting algorithms of different programming languages and the algorithm they use internally. C’s qsort() – Quicksort Best Case Time Complexity- O(NlogN) Average Case Time Complexity- O(NlogN) Worse Case Time Complexity- O(N2) Auxiliary… Read More »

Regex (Regular Expression) In C++

Regex is the short form for “Regular expression”, which is often used in this way in programming languages and many different libraries. It is supported in C++11 onward compilers. Function Templates used in regex regex_match() -This function return true if the regular expression is a match against the given string otherwise it returns false. Output:… Read More »

Implementation of Tic-Tac-Toe game

Rules of the Game The game is to be played between two people (in this program between HUMAN and COMPUTER). One of the player chooses ‘O’ and the other ‘X’ to mark their respective cells. The game starts with one of the players and the game ends when one of the players has one whole… Read More »

Queue Interface In Java

The java.util.Queue is a subtype of java.util.Collections. It is an ordered list of objects with its use limited to inserting elements at the end of list and deleting elements from the start of list i.e. it follows FIFO principle. Since it is an interface, we need a concrete class during its declaration. There are many… Read More »

BogoSort or Permutation Sort

BogoSort also known as permutation sort, stupid sort, slow sort, shotgun sort or monkey sort is a particularly ineffective algorithm based on generate and test paradigm. The algorithm successively generates permutations of its input until it finds one that is sorted.(Wiki) For example, if bogosort is used to sort a deck of cards, it would… Read More »

Print calendar for a given year

Prerequisite : Find day of the week for given date Problem: To print the calendar of any given year. The program should be such that it can prints the calendar of any input year. Sample Calendar: Implementation: Output: Calendar – 2016 ————January————- Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6… Read More »

Linux Virtualization : Linux Containers (lxc)

Pre-requisites: Earlier i talked about chroot jails and resource throttling using cgroups. If you haven’t read them yet, then i strongly suggest to go through them before proceeding ahead. https://www.youtube.com/watch?v=sK5i-N34im8 A vety good presentation by docker team. This will refresh some of the concepts learned above. This video acts as the bridge between this article… Read More »

Inter-thread Communication in Java

Prerequisite : Multithreading in Java, Synchronized in Java What is Polling and what are problems with it? The process of testing a condition repeatedly till it becomes true is known as polling. Polling is usually implemented with the help of loops to check whether a particular condition is true or not. If it is true,… Read More »