What is the complexity of dijkstra algorithm but without the vis array and without checking for dist array code https://ideone.com/VTaE03

Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

# | User | Rating |
---|---|---|

1 | tourist | 3469 |

2 | Radewoosh | 3357 |

3 | OO0OOO00O0OOO0O0…O | 3264 |

4 | LHiC | 3227 |

5 | ksun48 | 3184 |

6 | scott_wu | 3168 |

7 | Um_nik | 3166 |

8 | CongLingDanPaiSh…5 | 3157 |

9 | Petr | 3139 |

10 | V--o_o--V | 3135 |

# | User | Contrib. |
---|---|---|

1 | Radewoosh | 195 |

2 | Errichto | 175 |

3 | rng_58 | 158 |

4 | Ashishgup | 157 |

4 | neal | 157 |

6 | tourist | 154 |

7 | PikMike | 152 |

8 | Petr | 151 |

9 | Um_nik | 149 |

10 | kostka | 148 |

What is the complexity of dijkstra algorithm but without the vis array and without checking for dist array code https://ideone.com/VTaE03

↑

↓

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/19/2018 11:47:39 (d1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

What's the meaning of

`k`

in the code?k is the total amount of money i have and each edge have cost and length cost is p and length is l

It can be quadratic, for example this directed graph:

Initial node is connected with k nodes (with cost 1), these k nodes are connected with another node (middle)(with costs k, k — 1 , k — 2..., 1). Middle node is connected with another k nodes (with cost 1), which are connected to the final node (with cost oo, a.k.a. big enough).

Certainly middle node will be visited k times, and visiting it requires k operations, as it has k neighbours. So total complexity would be at least .

If I understood the code correctly it wouldn't be difficult to construct

O(2^{n}) in a similar way.