# All posts in Algorithms

Problem statement Goodland is a country with cities, and each city is sequentially numbered from to . These cities are connected by roads, and each road connects city to its neighboring city, . The distance between any two cities and is . Goodland’s government started a project to improve the . . . Read more

Problem statement The city of Gridland is represented as an matrix where the rows are numbered from to and the columns are numbered from to . Gridland has a network of train tracks that always run in straight horizontal lines along a row. In other words, the start and end . . . Read more

Knowing how to create a maze is as essential as breathing. So here is a simple algorithm to create mazes along with a link to a GitHub repository for its implementation in Swift. Algorithm 1. Start at cell (1, 1). 2. Find a neighbor at random that you haven’t yet . . . Read more

Problem Statement Given a graph G = (V, E), list all cycles within G. Algorithm 1. Compute a cycle basis of graph G = (V, E) * Find a minimal spanning tree (V, E’) of G, using Depth-first search (DFS) and its associated set of back edges * If e . . . Read more

Given S of size n and k, return the kth lexicographic permutation sequence. (Note: Given n will be between 1 and 10 inclusive.) For n = 10 variable symbols we have 10! possible permutations. The first step is to find the first symbol. If we fix a first symbol, then . . . Read more

Full code https://github.com/lucaslouca/sort-large-file