C++: Tic Tac Toe

Here is the simple C++ implementation of Tic Tac Toe.

Dijkstra's Algorithm | Single-Source Shortest Path

Dijkstra's algorithm finds shortest paths from the source vertex to all vertices in the graph. The condition for the algorithm is that all edge weights should be non-negative. Thus, Dijkstra’s...

Bellman Ford Algorithm | Single-Source Shortest Path

Bellman–Ford algorithm finds shortest path from the source vertex to all vertices in the graph. The graph can contain negative-weight edges, but it should not contain a negative-weight cycle that...

Breadth First Search using Adjacency List | Graph traversal

Breadth first search (BFS) explores the graph level by level. First it explore every vertex that is connected to source vertex. If the vertex is discovered, it becomes gray or...

Depth First Search using Adjacency List | Graph traversal

Depth first search explores on a single path in a graph as long as it find undiscovered vertices. When an edge leads to the discovered vertices it backtrack to the...

Move all Odd numbers after Even numbers in Singly Linked List | C++ Implementation

Given a Singly Linked List, we have to modify it such that all Even numbers appear before Odd numbers.

Merge two sorted Linked List (in-place) | C++ Implementation

Given two sorted Linked List, we have to merge them without using another linked list.

Split Singly Circular Linked List | C++ Implementation

Given a Singly Circular Linked List, we have to split it into two equal halves. If the number of nodes in the given list is odd then first list will...

Doubly Circular Linked List | C++ Implementation

A node in a doubly circular linked list contains a data item and two node pointers, one to the previous node and one to the next node. In doubly linked...

How to Reverse a Linked List | C++ Implementation

There are two ways to reverse a linked list, iterative method and recursive method.

How to find the Length of Loop in Linked List | C++ Implementation

Given a Linked List, we have to find does loop exist in Linked List and if yes, find the length of loop.

Selection sort | C++ Implementation

Selection sort is an in-place sorting algorithm. In the input array there is a sorted portion and an unsorted portion. The algorithm repeatedly finds the smallest element in the unsorted...