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

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

1 | tourist | 3434 |

2 | fateice | 3337 |

3 | Um_nik | 3292 |

4 | OO0OOO00O0OOO0O0…O | 3280 |

5 | Syloviaely | 3274 |

6 | Petr | 3223 |

7 | Swistakk | 3105 |

8 | mnbvmar | 3096 |

9 | yosupo | 3091 |

10 | dotorya | 3081 |

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

1 | rng_58 | 164 |

2 | tourist | 161 |

3 | csacademy | 153 |

4 | Petr | 150 |

5 | Swistakk | 148 |

6 | Um_nik | 144 |

7 | Nickolas | 142 |

7 | Vovuh | 142 |

9 | BledDest | 138 |

9 | PikMike | 138 |

9 | matthew99 | 138 |

9 | Errichto | 138 |

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: Jul/20/2018 15:50:14 (d1).

Desktop version, switch to mobile version.

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.