Code Race Question
Code Race Question
vehicle movement. The city's road network consists of Nintersections and Mone-way roads, each
with a maximum vehicle capacity per minute. The Al must determine the maximum number of
vehicles that can be routed from the main entry point (S) to the main exit (T) while respecting the
capacity limits of the roads.Design an efficient method for managing traffic in acity with one-way
INPUT:
OUTPUT:
An integer providingthe maximum number of vehicles per minute that can flow from S to T.
Test Case:
Case I:
Output: 28
1
2 Ahighly advanced teleportation network connects N planets through M one-way
teleporters. Each teleporter has a time cost, which can be normal travel time (positive),
Instantaneous teleportation (zero), or a special energy fields that reduce time (negative). However,
some teleporters form unstable loops, allowing indefinite time reduction. How would you
conceptually approach the detection of temporal anomalies in a constrained mobility system? Ifan
unstable loop exists, identify the planets involved in the loop. If no unstable loop exists, find the
fastest possible time to travel from planet S to planet T. IfT is unreachable, return "-1".
INPUT:
Output
0-2-1-5-6-7
2
8
Case II
Output:
-1
Case III
0-2:7
1-3: -9
3-4:5
2-4: 6
3-0: 4
Output:
UNSTABLE LOOP DETECTED, Planet 0, 1,3
3
a file say
3. Write a Cprogram and implement the following scenario. Consider
ficlds.
StudentsList.csv that contains the 30 records consisting of students name and cgpa
file, say
Sort the file contents in descending order with respect to cgpa in another
FinalStudentsList.csv. Now, from FinalStudentsList.csv, create a file (ProjectGroups.csv)
Project Member 1and
where each project group has three students with Team Leader,
Leader shall be one of the
Project Member 2. Team
one of the last 10 students
top 10 students based on CGPA, Project Member 2 shall be
of students.
based on the CGPA and Project Member 3 shall be one of the remaining list
group.
Each project group shall be unique in a way that one student belongs to only one
Leader,
Create a database table (StudentProjectGroups) with the Group Number, Team
Project Member 2 and Project Member 3. Consider a file with 30 unique research areas,
randomly pick three research areas and update the StudentProject Groups table by adding
three project areas in each group. Now, consider another database table (Faculty) with 10
Faculty with Faculty ID and Faculty Name. Randomly pick three research areas and update
the table (Faculty). The target is to assign Faculty to a Project Group in such a way the
preferences of the Students and Facultyare having a match. Make sureevery Faculty will
have at least two groups assigned under their supervision.
Note: Do not use any standard library function for sorting. Creating a table and updating it
shall be done using C and Database Connectivity by considering any Database API.
4
4. You are tasked with implementing a system that manages 5 stacks in asingle
array of fixed size. Each stack has an initially fixed size, but the stacks must grow
dynamicallywhen they run out of space. If a stack is full, it should borrow space from
the adjacent stack in acircular fashion. If the adjacent stack is also full, the system
should borrow space from the next adjacent stack and shift elements to make room.
Additionally, the system must handle the following complex scenario:
1. Initial Setup:
The total array size is 100 units.
Each stack is initially allocated 20 units of space.
The stacks are arranged in acircular fashion, meaning Stack 4 is adjacent to
Stack 0.
2. Operations to Perform:
Push 25 elements into Stack 0.
Push 15 elements into Stack 1.
Push 30 elements into Stack 2.
Push 10 elements into Stack 3.
Push 20 elements into Stack 4.
more
After the above operations, pop 5 elements from Stack 0 and push 10
elements into Stack 0.
into Stack 2.
o Then, pop 3 elements from Stack 2 and push 5 more elements
o Finally, pop all elements from Stack 4 and push 15 more
elements into Stack
4.
3. Constraints:
The system must ensure that no stack overwrites another stack's data.
Ifa stack borrows space from an adjacent stack, the elements of the adjacent
stack must be shifted to make room.
The system must handle the circular nature of the stacks, meaning Stack 4
can borrow space from Stack 0 if needed.
4. Output:
o After each operation, print the state of all stacks (their current elements).
At the end, print the final state of the array and the base and top pointers for
each stack.