A
A
Alexey Balashov2018-01-22 14:46:30
Algorithms
Alexey Balashov, 2018-01-22 14:46:30

How to find all possible permutations with combinations?

There is a list of "currency pairs"

tickersList
  • BTC_USD
  • BTC_EUR
  • BTC_RUB
  • BTC_UAH
  • BTC_PLN
  • BCH_BTC
  • BCH_USD
  • BCH_RUB
  • BCH_ETH
  • DASH_BTC
  • DASH_USD
  • DASH_RUB
  • ETH_BTC
  • ETH_LTC
  • ETH_USD
  • ETH_EUR
  • ETH_RUB
  • ETH_UAH
  • ETH_PLN
  • ETC_BTC
  • ETC_USD
  • ETC_RUB
  • LTC_BTC
  • LTC_USD
  • LTC_EUR
  • LTC_RUB
  • ZEC_BTC
  • ZEC_USD
  • ZEC_EUR
  • ZEC_RUB
  • XRP_BTC
  • XRP_USD
  • XRP_RUB
  • XMR_BTC
  • XMR_USD
  • XMR_EUR
  • BTC_USDT
  • ETH_USDT
  • USDT_USD
  • USDT_RUB
  • USD_RUB
  • DOGE_BTC
  • WAVES_BTC
  • WAVES_RUB
  • KICK_BTC
  • KICK_ETH

OutputCurrency_InputCurrency
Using the BTC_USD pair as an example:
Buying/selling BTC for USD
Task:
Find all possible chains of pairs ending and starting with the same "currency" and having all possible combinations from the list above. All chains of combinations of different levels of combinations.
For example, let's take a look at the BTC_USD pair:
The input currency is USD.
We can get a chain like this:
BTC_USD=>BCH_BTC=>BCH_USD
First thoughts.
1. nested loops with checking
2. recursion
3. combinatorics through permutations and
combinations

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-01-22
@Minifets

Build a graph and solve the traveling salesman problem, with the modification that you don't need to visit all vertices and need all solutions.

Y
Yerlan Ibraev, 2018-01-22
@mad_nazgul

The third option is 1 or 2. :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question