bk20dev / algorithmics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorithmics

This repository contains solutions to common (and some unusual) algorithmics problems.

๐Ÿ™ ships.cpp

All of us have propably ever played a game of ships. This program finds sizes of all ships on a board.

How to use

  1. Create a file named ships.txt
  2. Fill the file with a square of size 8x8 filled with 0 (water) and 1 (ship).

๐Ÿ’ก Tip: If you are not sure how the file should look like, feel free to take a look at the example in ./samples/ directory.

  1. Compile the program
g++ ships.cpp -o ships.out
  1. Run the program and watch the console window
./ships.out

๐Ÿช lzw.cpp

Compresses a file using Lempel-Ziv-Welch technique

How to use

  1. Create a file named input.txt
  2. Fill the file with some text (eg. lorem ipsum)
  3. Compile the program
g++ lzw.cpp -o lzw.out
  1. Run the program
./lzw.out
  1. Open the newly created compressed.txt

๐ŸŒ€ spiral.cpp

Fills spirally a square array with consecutive numbers in the choosen direction.

How to use

  1. Compile the program
g++ spiral.cpp -o spiral.out
  1. Run the program
./spiral.out
  1. Input a direction
    • 0 for counter-clockwise
    • 1 for clockwise
  2. Type in a size
  3. Watch the console window

About


Languages

Language:C++ 100.0%