dancealgorithm 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. dancealgorithm/__init__.py +12 -9
  2. dancealgorithm/__main__.py +1 -0
  3. dancealgorithm/assignments/DA - Campus/__init__.py +4 -0
  4. dancealgorithm/assignments/DA - Flight/__init__.py +4 -0
  5. dancealgorithm/assignments/DA - Smart/__init__.py +4 -0
  6. dancealgorithm/assignments/FK - Advertisement/__init__.py +4 -0
  7. dancealgorithm/assignments/FK - Electric/__init__.py +4 -0
  8. dancealgorithm/assignments/FK - Emergency/__init__.py +4 -0
  9. dancealgorithm/assignments/GC - Classroom/Solution.java +119 -87
  10. dancealgorithm/assignments/GC - Classroom/__init__.py +4 -0
  11. dancealgorithm/assignments/GC - Interference/Solution.java +120 -88
  12. dancealgorithm/assignments/GC - Interference/__init__.py +4 -0
  13. dancealgorithm/assignments/GC - University/Solution.java +119 -88
  14. dancealgorithm/assignments/GC - University/__init__.py +4 -0
  15. dancealgorithm/assignments/K - Cloud/__init__.py +4 -0
  16. dancealgorithm/assignments/K - Disaster/__init__.py +4 -0
  17. dancealgorithm/assignments/K - Hospital/__init__.py +4 -0
  18. dancealgorithm/assignments/LC - Delivery/Solution.java +261 -180
  19. dancealgorithm/assignments/LC - Delivery/__init__.py +4 -0
  20. dancealgorithm/assignments/LC - Drilling/Solution.java +275 -197
  21. dancealgorithm/assignments/LC - Drilling/__init__.py +4 -0
  22. dancealgorithm/assignments/LC - Flight/Solution.java +261 -180
  23. dancealgorithm/assignments/LC - Flight/__init__.py +4 -0
  24. dancealgorithm/assignments/MS - Commerce/__init__.py +4 -0
  25. dancealgorithm/assignments/MS - Customer/__init__.py +4 -0
  26. dancealgorithm/assignments/MS - Library/__init__.py +4 -0
  27. dancealgorithm/assignments/MSG - Emergency/__init__.py +4 -0
  28. dancealgorithm/assignments/MSG - Logistics/__init__.py +4 -0
  29. dancealgorithm/assignments/MSG - Skyconnect/__init__.py +4 -0
  30. dancealgorithm/assignments/QS - Commerce/__init__.py +4 -0
  31. dancealgorithm/assignments/QS - Movie/__init__.py +4 -0
  32. dancealgorithm/assignments/QS - Online/__init__.py +4 -0
  33. dancealgorithm/assignments/__init__.py +25 -25
  34. dancealgorithm/downloader.py +7 -6
  35. {dancealgorithm-0.1.0.dist-info → dancealgorithm-0.1.2.dist-info}/METADATA +22 -19
  36. {dancealgorithm-0.1.0.dist-info → dancealgorithm-0.1.2.dist-info}/RECORD +40 -40
  37. {dancealgorithm-0.1.0.dist-info → dancealgorithm-0.1.2.dist-info}/WHEEL +0 -0
  38. {dancealgorithm-0.1.0.dist-info → dancealgorithm-0.1.2.dist-info}/entry_points.txt +0 -0
  39. {dancealgorithm-0.1.0.dist-info → dancealgorithm-0.1.2.dist-info}/licenses/LICENSE +0 -0
  40. {dancealgorithm-0.1.0.dist-info → dancealgorithm-0.1.2.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@ import sys
9
9
  from pathlib import Path
10
10
  from typing import Any, Dict, List, Optional, Union
11
11
 
12
- __version__ = "0.1.0"
12
+ __version__ = "0.1.2"
13
13
 
14
14
  # Import bundled assignments registry and sheets
15
15
  from dancealgorithm.assignments import ASSIGNMENTS_DIR, REGISTRY, SHEETS
@@ -34,8 +34,8 @@ for sheet in SHEETS:
34
34
 
35
35
  def get(identifier: Union[int, str]) -> Any:
36
36
  """
37
- Get a specific problem sheet module by number (1..24), ID (e.g. 'ps1', 'PS01'),
38
- or keyword/name (e.g. 'Customer', 'MS - Customer', 'GC - Classroom').
37
+ Get a specific problem sheet module by number (1..18), ID (e.g. 'ps1', 'PS01'),
38
+ or keyword/name (e.g. 'Customer', 'MS - Customer', 'MSG - Logistics').
39
39
  """
40
40
  if identifier in REGISTRY:
41
41
  return REGISTRY[identifier]
@@ -57,7 +57,7 @@ def get(identifier: Union[int, str]) -> Any:
57
57
  if norm in clean_title or clean_title in norm:
58
58
  return sheet
59
59
 
60
- raise KeyError(f"Problem sheet not found for '{identifier}'. Available: 1..24.")
60
+ raise KeyError(f"Problem sheet not found for '{identifier}'. Available: 1..18.")
61
61
 
62
62
 
63
63
  # Convenience alias: dancealgorithm.ps(1)
@@ -86,7 +86,7 @@ def extract(
86
86
  ) -> List[Path]:
87
87
  """
88
88
  Extract all problem sheets or a specific one to the destination directory.
89
- Default destination is C:\\DAA_Assignments (or ~/DAA_Assignments).
89
+ Default destination is C:\\DAA_Assignments on Windows (or ~/DAA_Assignments on Linux).
90
90
  """
91
91
  from dancealgorithm.config import get_destination
92
92
  from dancealgorithm.downloader import extract_bundled
@@ -98,13 +98,18 @@ def extract(
98
98
 
99
99
  def open_folder(destination: Optional[Union[str, Path]] = None) -> None:
100
100
  """
101
- Open the assignments destination folder in Windows File Explorer.
101
+ Open the assignments destination folder in the default system file manager.
102
+ Works seamlessly on Windows (explorer), macOS (open), and Linux (xdg-open).
102
103
  """
103
104
  from dancealgorithm.config import get_destination
104
105
  target = Path(destination) if destination else get_destination()
105
106
  target.mkdir(parents=True, exist_ok=True)
106
107
  if sys.platform == "win32":
107
108
  os.system(f'explorer "{target}"')
109
+ elif sys.platform == "darwin":
110
+ os.system(f'open "{target}"')
111
+ else:
112
+ os.system(f'xdg-open "{target}" 2>/dev/null &')
108
113
 
109
114
 
110
115
  def __getattr__(name: str) -> Any:
@@ -123,6 +128,4 @@ __all__ = [
123
128
  "extract",
124
129
  "open_folder",
125
130
  ]
126
-
127
-
128
-
131
+
@@ -6,3 +6,4 @@ from dancealgorithm.cli import main
6
6
 
7
7
  if __name__ == "__main__":
8
8
  sys.exit(main())
9
+
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -1,87 +1,119 @@
1
- import java.util.Arrays;
2
-
3
- // Main solution
4
- public class Solution {
5
- // O(V * m^V)
6
-
7
- // Safety check
8
- public static boolean isSafe(int v, int[][] graph, int[] color, int c, int V) {
9
- for (int i = 0; i < V; i++) {
10
- if (graph[v][i] == 1 && color[i] == c) {
11
- return false;
12
- }
13
- }
14
- return true;
15
- }
16
-
17
- // Backtracking search
18
- public static boolean graphColoringUtil(int[][] graph, int m, int[] color, int v, int V) {
19
- if (v == V) {
20
- return true;
21
- }
22
-
23
- for (int c = 1; c <= m; c++) {
24
- if (isSafe(v, graph, color, c, V)) {
25
- color[v] = c;
26
-
27
- if (graphColoringUtil(graph, m, color, v + 1, V)) {
28
- return true;
29
- }
30
-
31
- // Backtrack
32
- color[v] = 0;
33
- }
34
- }
35
- return false;
36
- }
37
-
38
- public static void classroomScheduler(int[][] graph, int m, String[] lectures) {
39
- int V = lectures.length;
40
- int[] color = new int[V];
41
- Arrays.fill(color, 0);
42
-
43
- System.out.println("\nAcademic Classroom Allocation (Conflict-Free Scheduling):");
44
- System.out.println("------------------------------------------------------------------");
45
-
46
- if (!graphColoringUtil(graph, m, color, 0, V)) {
47
- System.out.println("Cannot schedule all lectures with " + m + " classrooms without conflicts.");
48
- } else {
49
- System.out.printf("%-30s %-20s%n", "Lecture Session", "Allocated Classroom");
50
- System.out.println("------------------------------------------------------------------");
51
- for (int i = 0; i < V; i++) {
52
- System.out.printf("%-30s Room Hall %d%n", lectures[i], color[i]);
53
- }
54
- System.out.println("------------------------------------------------------------------");
55
- System.out.println("Status: All lectures scheduled with zero room booking collisions.");
56
- }
57
- }
58
-
59
- // Driver code
60
- public static void main(String[] args) {
61
- System.out.println("=======================================================================");
62
- System.out.println("PS 20: Classroom Scheduling Without Conflicts (Graph Coloring - Java)");
63
- System.out.println("=======================================================================");
64
-
65
- String[] lectures = {
66
- "Physics 101 (9:00 - 10:00 AM)", // 0
67
- "Chemistry 101 (9:30 - 10:30 AM)", // 1
68
- "Math 201 (10:00 - 11:00 AM)", // 2
69
- "Biology 101 (10:30 - 11:30 AM)", // 3
70
- "English 102 (9:00 - 10:30 AM)", // 4
71
- "History 101 (11:00 - 12:00 PM)" // 5
72
- };
73
- int V = lectures.length;
74
-
75
- int[][] conflictGraph = {
76
- {0, 1, 0, 0, 1, 0},
77
- {1, 0, 1, 0, 1, 0},
78
- {0, 1, 0, 1, 1, 0},
79
- {0, 0, 1, 0, 0, 1},
80
- {1, 1, 1, 0, 0, 0},
81
- {0, 0, 0, 1, 0, 0}
82
- };
83
-
84
- int availableClassrooms = 3;
85
- classroomScheduler(conflictGraph, availableClassrooms, lectures);
86
- }
87
- }
1
+
2
+ import java.util.*;
3
+
4
+ public class Solution {
5
+ // 1. Main Function
6
+ public static void main(String args[]) {
7
+ Scanner sc = new Scanner(System.in);
8
+
9
+ System.out.print("Enter number of lectures: ");
10
+ int iSize = sc.nextInt();
11
+
12
+ String sLectures[] = new String[iSize];
13
+
14
+ // 2. Get Lecture Details
15
+ sc.nextLine();
16
+
17
+ for (int iCnt = 0; iCnt < iSize; iCnt++) {
18
+ System.out.print("Enter lecture " + (iCnt + 1) + ": ");
19
+ sLectures[iCnt] = sc.nextLine();
20
+ }
21
+
22
+ // 3. Create Conflict Graph
23
+ int iGraph[][] = new int[iSize][iSize];
24
+
25
+ System.out.print("Enter number of conflict pairs: ");
26
+ int iPairs = sc.nextInt();
27
+
28
+ for (int iCnt = 0; iCnt < iPairs; iCnt++) {
29
+ System.out.println("\nEnter lecture numbers for conflict pair " + (iCnt + 1));
30
+
31
+ System.out.print("First lecture: ");
32
+ int iU = sc.nextInt() - 1;
33
+
34
+ System.out.print("Second lecture: ");
35
+ int iV = sc.nextInt() - 1;
36
+
37
+ if (iU >= 0 && iU < iSize && iV >= 0 &&
38
+ iV < iSize && iU != iV) {
39
+ iGraph[iU][iV] = 1;
40
+ iGraph[iV][iU] = 1;
41
+ } else {
42
+ System.out.println("Invalid lecture numbers!");
43
+ iCnt--;
44
+ }
45
+ }
46
+
47
+ // 4. Get Available Classrooms
48
+ System.out.print("\nEnter available classrooms: ");
49
+ int iRooms = sc.nextInt();
50
+
51
+ // 5. Apply Graph Coloring
52
+ ClassroomScheduler(iGraph, iRooms, sLectures);
53
+
54
+ sc.close();
55
+ }
56
+
57
+ // 6. Check Whether Color Is Safe
58
+ static boolean IsSafe(int iV, int iGraph[][],
59
+ int iColor[], int iC, int iSize) {
60
+ for (int iCnt = 0; iCnt < iSize; iCnt++) {
61
+ if (iGraph[iV][iCnt] == 1 && iColor[iCnt] == iC) {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ return true;
67
+ }
68
+
69
+ // 7. Graph Coloring Using Backtracking
70
+ static boolean GraphColoring(int iGraph[][], int iRooms,
71
+ int iColor[], int iV, int iSize) {
72
+ if (iV == iSize) {
73
+ return true;
74
+ }
75
+
76
+ for (int iC = 1; iC <= iRooms; iC++) {
77
+ if (IsSafe(iV, iGraph, iColor, iC, iSize)) {
78
+ iColor[iV] = iC;
79
+
80
+ if (GraphColoring(iGraph, iRooms, iColor,
81
+ iV + 1, iSize)) {
82
+ return true;
83
+ }
84
+
85
+ // Backtrack
86
+ iColor[iV] = 0;
87
+ }
88
+ }
89
+
90
+ return false;
91
+ }
92
+
93
+ // 8. Classroom Scheduler
94
+ static void ClassroomScheduler(int iGraph[][],
95
+ int iRooms, String sLectures[]) {
96
+ int iSize = sLectures.length;
97
+ int iColor[] = new int[iSize];
98
+
99
+ System.out.println("\nClassroom Allocation:");
100
+ System.out.println("------------------------------------------------");
101
+
102
+ if (!GraphColoring(iGraph, iRooms, iColor, 0, iSize)) {
103
+ System.out.println("Cannot schedule all lectures without conflicts!");
104
+ } else {
105
+ System.out.printf("%-35s %-20s%n",
106
+ "Lecture Session", "Allocated Classroom");
107
+
108
+ System.out.println("------------------------------------------------");
109
+
110
+ for (int iCnt = 0; iCnt < iSize; iCnt++) {
111
+ System.out.printf("%-35s Room Hall %d%n",
112
+ sLectures[iCnt], iColor[iCnt]);
113
+ }
114
+
115
+ System.out.println("------------------------------------------------");
116
+ System.out.println("Status: All lectures scheduled without conflicts.");
117
+ }
118
+ }
119
+ }
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):
@@ -1,88 +1,120 @@
1
- import java.util.Arrays;
2
-
3
- // Main solution
4
- public class Solution {
5
- // O(V * m^V)
6
-
7
- // Safety check
8
- public static boolean isSafe(int v, int[][] graph, int[] color, int c, int V) {
9
- for (int i = 0; i < V; i++) {
10
- if (graph[v][i] == 1 && color[i] == c) {
11
- return false;
12
- }
13
- }
14
- return true;
15
- }
16
-
17
- // Backtracking search
18
- public static boolean graphColoringUtil(int[][] graph, int m, int[] color, int v, int V) {
19
- if (v == V) {
20
- return true;
21
- }
22
-
23
- for (int c = 1; c <= m; c++) {
24
- if (isSafe(v, graph, color, c, V)) {
25
- color[v] = c;
26
-
27
- if (graphColoringUtil(graph, m, color, v + 1, V)) {
28
- return true;
29
- }
30
-
31
- // Backtrack
32
- color[v] = 0;
33
- }
34
- }
35
- return false;
36
- }
37
-
38
- // Solver entry
39
- public static void frequencyAllocator(int[][] graph, int m, String[] towers) {
40
- int V = towers.length;
41
- int[] color = new int[V];
42
- Arrays.fill(color, 0);
43
-
44
- System.out.println("\nCellular Network Interference-Free Frequency Band Allocation:");
45
- System.out.println("------------------------------------------------------------------");
46
-
47
- if (!graphColoringUtil(graph, m, color, 0, V)) {
48
- System.out.println("Cannot allocate frequencies without RF interference using " + m + " channels.");
49
- } else {
50
- System.out.printf("%-26s %-22s%n", "Cellular Tower", "Assigned Frequency Channel");
51
- System.out.println("------------------------------------------------------------------");
52
- for (int i = 0; i < V; i++) {
53
- System.out.printf("%-26s Channel %d (Band %d MHz)%n", towers[i], color[i], 800 + color[i] * 50);
54
- }
55
- System.out.println("------------------------------------------------------------------");
56
- System.out.println("Status: Zero co-channel interference across neighboring base stations.");
57
- }
58
- }
59
-
60
- // Driver code
61
- public static void main(String[] args) {
62
- System.out.println("=======================================================================");
63
- System.out.println("PS 21: Mobile Tower Frequency Allocation (Graph Coloring - Java)");
64
- System.out.println("=======================================================================");
65
-
66
- String[] towers = {
67
- "Tower 1 (Marine Drive)", // 0
68
- "Tower 2 (Bandra West)", // 1
69
- "Tower 3 (Andheri East)", // 2
70
- "Tower 4 (Kurla Junction)", // 3
71
- "Tower 5 (Powai Hiranandani)", // 4
72
- "Tower 6 (CSMI Airport Terminal)" // 5
73
- };
74
- int V = towers.length;
75
-
76
- int[][] interferenceGraph = {
77
- {0, 1, 1, 0, 0, 0},
78
- {1, 0, 1, 1, 0, 0},
79
- {1, 1, 0, 1, 1, 0},
80
- {0, 1, 1, 0, 1, 1},
81
- {0, 0, 1, 1, 0, 1},
82
- {0, 0, 0, 1, 1, 0}
83
- };
84
-
85
- int availableChannels = 3;
86
- frequencyAllocator(interferenceGraph, availableChannels, towers);
87
- }
88
- }
1
+
2
+ import java.util.*;
3
+
4
+ public class Solution {
5
+ // 1. Main Function
6
+ public static void main(String args[]) {
7
+ Scanner sc = new Scanner(System.in);
8
+
9
+ System.out.print("Enter number of towers: ");
10
+ int iSize = sc.nextInt();
11
+
12
+ String sTowers[] = new String[iSize];
13
+
14
+ // 2. Get Tower Names
15
+ sc.nextLine();
16
+
17
+ for (int iCnt = 0; iCnt < iSize; iCnt++) {
18
+ System.out.print("Enter tower " + (iCnt + 1) + ": ");
19
+ sTowers[iCnt] = sc.nextLine();
20
+ }
21
+
22
+ // 3. Create Interference Graph
23
+ int iGraph[][] = new int[iSize][iSize];
24
+
25
+ System.out.print("Enter number of interference pairs: ");
26
+ int iPairs = sc.nextInt();
27
+
28
+ for (int iCnt = 0; iCnt < iPairs; iCnt++) {
29
+ System.out.println("\nEnter tower numbers for interference pair " + (iCnt + 1));
30
+
31
+ System.out.print("First tower: ");
32
+ int iU = sc.nextInt() - 1;
33
+
34
+ System.out.print("Second tower: ");
35
+ int iV = sc.nextInt() - 1;
36
+
37
+ if (iU >= 0 && iU < iSize && iV >= 0 &&
38
+ iV < iSize && iU != iV) {
39
+ iGraph[iU][iV] = 1;
40
+ iGraph[iV][iU] = 1;
41
+ } else {
42
+ System.out.println("Invalid tower numbers!");
43
+ iCnt--;
44
+ }
45
+ }
46
+
47
+ // 4. Get Available Frequency Channels
48
+ System.out.print("\nEnter available frequency channels: ");
49
+ int iChannels = sc.nextInt();
50
+
51
+ // 5. Apply Graph Coloring
52
+ FrequencyAllocator(iGraph, iChannels, sTowers);
53
+
54
+ sc.close();
55
+ }
56
+
57
+ // 6. Check Whether Color Is Safe
58
+ static boolean IsSafe(int iV, int iGraph[][],
59
+ int iColor[], int iC, int iSize) {
60
+ for (int iCnt = 0; iCnt < iSize; iCnt++) {
61
+ if (iGraph[iV][iCnt] == 1 && iColor[iCnt] == iC) {
62
+ return false;
63
+ }
64
+ }
65
+
66
+ return true;
67
+ }
68
+
69
+ // 7. Graph Coloring Using Backtracking
70
+ static boolean GraphColoring(int iGraph[][], int iChannels,
71
+ int iColor[], int iV, int iSize) {
72
+ if (iV == iSize) {
73
+ return true;
74
+ }
75
+
76
+ for (int iC = 1; iC <= iChannels; iC++) {
77
+ if (IsSafe(iV, iGraph, iColor, iC, iSize)) {
78
+ iColor[iV] = iC;
79
+
80
+ if (GraphColoring(iGraph, iChannels, iColor,
81
+ iV + 1, iSize)) {
82
+ return true;
83
+ }
84
+
85
+ // Backtrack
86
+ iColor[iV] = 0;
87
+ }
88
+ }
89
+
90
+ return false;
91
+ }
92
+
93
+ // 8. Frequency Allocator
94
+ static void FrequencyAllocator(int iGraph[][],
95
+ int iChannels, String sTowers[]) {
96
+ int iSize = sTowers.length;
97
+ int iColor[] = new int[iSize];
98
+
99
+ System.out.println("\nCellular Network Frequency Allocation:");
100
+ System.out.println("---------------------------------------------------------------");
101
+
102
+ if (!GraphColoring(iGraph, iChannels, iColor, 0, iSize)) {
103
+ System.out.println("Cannot allocate frequencies without interference!");
104
+ } else {
105
+ System.out.printf("%-28s %-20s%n",
106
+ "Cellular Tower", "Frequency Channel");
107
+
108
+ System.out.println("---------------------------------------------------------------");
109
+
110
+ for (int iCnt = 0; iCnt < iSize; iCnt++) {
111
+ System.out.printf("%-28s Channel %d (Band %d MHz)%n",
112
+ sTowers[iCnt], iColor[iCnt],
113
+ 800 + iColor[iCnt] * 50);
114
+ }
115
+
116
+ System.out.println("---------------------------------------------------------------");
117
+ System.out.println("Status: All towers allocated without interference.");
118
+ }
119
+ }
120
+ }
@@ -25,6 +25,10 @@ def open_folder() -> None:
25
25
  import os
26
26
  if sys.platform == "win32":
27
27
  os.system(f'explorer "{PATH}"')
28
+ elif sys.platform == "darwin":
29
+ os.system(f'open "{PATH}"')
30
+ else:
31
+ os.system(f'xdg-open "{PATH}" 2>/dev/null &')
28
32
 
29
33
  def __getattr__(name: str):
30
34
  if name in ("code", "java_code", "solution_code"):