Breadth First Search: Shortest Reach

Sort by

recency

|

702 Discussions

|

  • + 0 comments

    vector bfs(int n, int m, vector> edges, int s) { vectorAdjList[n+1]; for (int i=0;i

    vector<int>status(n+1,-1);
    queue<int>Q;
    Q.push(s);
    status[s]=0;
    
    while(!Q.empty()){
         int x=Q.front();
    Q.pop();
    for(int j =0;j<AdjList[x].size();j++)
    {
        int y=AdjList[x][j];
        if(status[y]==-1)
        {
            status[y]=status[x]+6;
            Q.push(y);
        }
    }
    
    }
    vector<int>ans;
    for(int i=1;i<=n;i++)
    {
        if(i!=s)
        {
            ans.push_back(status[i]);
        }
    }
    return ans;
    

    }

  • + 0 comments

    Interesting discussion — just like algorithms help you efficiently find shortest paths in graphs, having quick access to essential information can make real-world tasks smoother too; for example, if anyone needs to understand how to check or use their national id online and learn about both the physical and digital Philippine National ID system, this resource explains it clearly national id online, which can be especially useful when you’re verifying identity for services or official purposes.

  • + 0 comments

    This BFS shortest reach problem is a good reminder of how efficiently breadth-first search finds minimum distances in unweighted graphs by visiting nodes level by level. In real life, we also rely on efficient systems to quickly access important information without unnecessary steps. For example, drivers in the Philippines can easily check their vehicle plate or license status online using tools like lto tracker plate, which helps save time and avoid long queues at LTO offices.

  • + 0 comments

    Offers an organized list of official national ramazan ne zaman başlıyor holidays, religious festivities, and significant cultural dates used for planning and scheduling.

  • + 0 comments

    how is this 55 points while synchronous-shopping is 40