PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Akuna Capital

Compute delivery order via BFS

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in graph algorithms and shortest-path reasoning, multi-criteria ordering and tie-breaking, and analysis of time and space complexity while handling unreachable nodes.

  • Medium
  • Akuna Capital
  • Coding & Algorithms
  • Data Scientist

Compute delivery order via BFS

Company: Akuna Capital

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

A city road network is an unweighted, undirected graph G(V, E) with a depot node s and D delivery requests located at nodes r1..rD, each with an integer priority p and a unique ID. Produce the service order that sorts deliveries by increasing shortest-hop distance from s, breaking ties by higher priority first, then by smaller ID. Design an algorithm that runs in O(V+E + D log D) by performing a BFS from s to compute distances and then sorting the requests by (distance asc, priority desc, ID asc). Explain correctness, handle unreachable nodes, and provide pseudocode.

Quick Answer: This question evaluates proficiency in graph algorithms and shortest-path reasoning, multi-criteria ordering and tie-breaking, and analysis of time and space complexity while handling unreachable nodes.

Related Interview Questions

  • Find minimum swaps to sort array with duplicates - Akuna Capital (hard)
  • Heapify an array into a max-heap - Akuna Capital (Medium)
  • Implement a ring buffer - Akuna Capital (Medium)
  • Compute max profit across dated stock quotes - Akuna Capital (Medium)
  • Break a palindrome to smallest non-palindrome - Akuna Capital (Medium)
Akuna Capital logo
Akuna Capital
Aug 10, 2025, 12:00 AM
Data Scientist
Technical Screen
Coding & Algorithms
2
0

A city road network is an unweighted, undirected graph G(V, E) with a depot node s and D delivery requests located at nodes r1..rD, each with an integer priority p and a unique ID. Produce the service order that sorts deliveries by increasing shortest-hop distance from s, breaking ties by higher priority first, then by smaller ID. Design an algorithm that runs in O(V+E + D log D) by performing a BFS from s to compute distances and then sorting the requests by (distance asc, priority desc, ID asc). Explain correctness, handle unreachable nodes, and provide pseudocode.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Akuna Capital•More Data Scientist•Akuna Capital Data Scientist•Akuna Capital Coding & Algorithms•Data Scientist Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.