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 | 3645 |

2 | Radewoosh | 3403 |

3 | Um_nik | 3348 |

4 | LHiC | 3336 |

5 | Benq | 3316 |

6 | V--o_o--V | 3275 |

7 | mnbvmar | 3241 |

8 | yutaka1999 | 3190 |

9 | ainta | 3180 |

10 | Petr | 3106 |

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

1 | Errichto | 191 |

2 | Radewoosh | 177 |

3 | rng_58 | 164 |

4 | PikMike | 162 |

5 | Vovuh | 160 |

6 | majk | 158 |

7 | 300iq | 154 |

8 | antontrygubO_o | 153 |

9 | Um_nik | 151 |

10 | kostka | 149 |

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-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/19/2019 11:49:58 (e2).

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.