dancealgorithm 0.1.1__tar.gz → 0.1.2__tar.gz
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.
- {dancealgorithm-0.1.1/src/dancealgorithm.egg-info → dancealgorithm-0.1.2}/PKG-INFO +26 -11
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/README.md +25 -10
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/pyproject.toml +1 -1
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/__init__.py +3 -3
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC - Classroom/Solution.java +119 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC - Classroom/__init__.py +38 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC - Interference/Solution.java +120 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC - Interference/__init__.py +38 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC - University/Solution.java +119 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC - University/__init__.py +38 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/GC.txt +25 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC - Delivery/Solution.java +261 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC - Delivery/__init__.py +38 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC - Drilling/Solution.java +275 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC - Drilling/__init__.py +38 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC - Flight/Solution.java +261 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC - Flight/__init__.py +38 -0
- dancealgorithm-0.1.2/src/dancealgorithm/assignments/LC.txt +31 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/__init__.py +7 -1
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/downloader.py +8 -1
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2/src/dancealgorithm.egg-info}/PKG-INFO +26 -11
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm.egg-info/SOURCES.txt +14 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/LICENSE +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/setup.cfg +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/__main__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA - Campus/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA - Campus/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA - Flight/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA - Flight/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA - Smart/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA - Smart/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/DA.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK - Advertisement/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK - Advertisement/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK - Electric/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK - Electric/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK - Emergency/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK - Emergency/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/FK.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K - Cloud/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K - Cloud/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K - Disaster/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K - Disaster/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K - Hospital/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K - Hospital/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/K.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Commerce/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Commerce/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Commerce/dataset.csv +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Customer/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Customer/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Customer/dataset.csv +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Library/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Library/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS - Library/dataset.csv +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MS.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG - Emergency/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG - Emergency/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG - Logistics/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG - Logistics/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG - Skyconnect/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG - Skyconnect/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/MSG.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Commerce/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Commerce/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Commerce/dataset.csv +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Movie/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Movie/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Movie/dataset.csv +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Online/Solution.java +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Online/__init__.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS - Online/dataset.csv +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/assignments/QS.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/cli.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm/config.py +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm.egg-info/dependency_links.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm.egg-info/entry_points.txt +0 -0
- {dancealgorithm-0.1.1 → dancealgorithm-0.1.2}/src/dancealgorithm.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dancealgorithm
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: DanceAlgorithm: Instant DAA Algorithms, Lab Problem Sheets, Datasets, and Code Vault.
|
|
5
5
|
Author: DanceAlgorithm Maintainer
|
|
6
6
|
License-Expression: MIT
|
|
@@ -26,7 +26,7 @@ Dynamic: license-file
|
|
|
26
26
|
# ⚡ DanceAlgorithm
|
|
27
27
|
|
|
28
28
|
> **Instant DAA Problem Sheets, Datasets, Solutions & Algorithm Vault**
|
|
29
|
-
> Download, extract, organize, and directly **import** all
|
|
29
|
+
> Download, extract, organize, and directly **import** all 24 Design & Analysis of Algorithms (DAA) lab practical problem sheets, datasets, and Java solutions cleanly onto your PC or Linux machine with a single command or Python import.
|
|
30
30
|
|
|
31
31
|
[](https://pypi.org/project/dancealgorithm/)
|
|
32
32
|
[](https://www.python.org/)
|
|
@@ -38,7 +38,7 @@ Dynamic: license-file
|
|
|
38
38
|
|
|
39
39
|
## 🌟 The Magic Experience
|
|
40
40
|
|
|
41
|
-
### Option A: Install & Extract All
|
|
41
|
+
### Option A: Install & Extract All 24 Problem Sheets
|
|
42
42
|
|
|
43
43
|
```powershell
|
|
44
44
|
pip install dancealgorithm; dance
|
|
@@ -50,7 +50,7 @@ Or run `dance` (or `dancealgorithm`) anytime in your terminal:
|
|
|
50
50
|
dance
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Your `C:\DAA_Assignments` folder (or `~/DAA_Assignments` on Linux) is cleanly populated with all
|
|
53
|
+
Your `C:\DAA_Assignments` folder (or `~/DAA_Assignments` on Linux) is cleanly populated with all 24 problem sheets:
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
56
|
C:\DAA_Assignments\
|
|
@@ -60,9 +60,10 @@ C:\DAA_Assignments\
|
|
|
60
60
|
├── MS - Commerce/
|
|
61
61
|
│ ├── dataset.csv
|
|
62
62
|
│ └── Solution.java
|
|
63
|
-
├── MS - Library/
|
|
64
63
|
├── ...
|
|
65
|
-
|
|
64
|
+
├── GC - University/
|
|
65
|
+
│ └── Solution.java
|
|
66
|
+
└── LC - Drilling/
|
|
66
67
|
└── Solution.java
|
|
67
68
|
```
|
|
68
69
|
|
|
@@ -92,9 +93,15 @@ dance K.txt
|
|
|
92
93
|
|
|
93
94
|
# Multistage Graph backward DP
|
|
94
95
|
dance MSG.txt
|
|
96
|
+
|
|
97
|
+
# Graph Coloring backtracking analysis
|
|
98
|
+
dance GC.txt
|
|
99
|
+
|
|
100
|
+
# TSP - Least Cost Branch & Bound analysis
|
|
101
|
+
dance LC.txt
|
|
95
102
|
```
|
|
96
103
|
|
|
97
|
-
*(You can also use `dancealgorithm DA.txt` or `dance DA`)*
|
|
104
|
+
*(You can also use `dancealgorithm DA.txt`, `dance GC.txt`, or `dance DA`)*
|
|
98
105
|
|
|
99
106
|
### 2. Extract a Specific Assignment Folder
|
|
100
107
|
|
|
@@ -104,12 +111,14 @@ Extract only that particular folder:
|
|
|
104
111
|
# Extract unquoted or quoted
|
|
105
112
|
dance MSG - Logistics
|
|
106
113
|
dance "DA - Smart"
|
|
107
|
-
dance "
|
|
114
|
+
dance "GC - Classroom"
|
|
115
|
+
dance "LC - Delivery"
|
|
108
116
|
|
|
109
117
|
# Or extract by problem number
|
|
110
118
|
dance 1
|
|
111
|
-
dance 10
|
|
112
119
|
dance 13
|
|
120
|
+
dance 19
|
|
121
|
+
dance 24
|
|
113
122
|
```
|
|
114
123
|
|
|
115
124
|
### 3. List All Available Problem Sheets & Notes
|
|
@@ -122,7 +131,7 @@ dance list
|
|
|
122
131
|
|
|
123
132
|
## 🐍 Option B: Direct Python Import
|
|
124
133
|
|
|
125
|
-
All
|
|
134
|
+
All 24 assignments can be directly inspected or extracted programmatically:
|
|
126
135
|
|
|
127
136
|
```python
|
|
128
137
|
import dancealgorithm
|
|
@@ -143,7 +152,7 @@ dancealgorithm.open_folder()
|
|
|
143
152
|
|
|
144
153
|
---
|
|
145
154
|
|
|
146
|
-
## 📚 Complete Catalogue of All
|
|
155
|
+
## 📚 Complete Catalogue of All 24 DAA Problem Sheets
|
|
147
156
|
|
|
148
157
|
| No. | Algorithm | Category | Problem Sheet Title | Time Complexity |
|
|
149
158
|
|---|---|---|---|---|
|
|
@@ -165,6 +174,12 @@ dancealgorithm.open_folder()
|
|
|
165
174
|
| **16** | 0/1 Knapsack | Dynamic Programming | `K - Disaster` | $O(n \cdot W)$ |
|
|
166
175
|
| **17** | 0/1 Knapsack | Dynamic Programming | `K - Hospital` | $O(n \cdot W)$ |
|
|
167
176
|
| **18** | 0/1 Knapsack | Dynamic Programming | `K - Cloud` | $O(n \cdot W)$ |
|
|
177
|
+
| **19** | Graph Coloring | Backtracking | `GC - University` | $O(V \cdot m^V)$ |
|
|
178
|
+
| **20** | Graph Coloring | Backtracking | `GC - Classroom` | $O(V \cdot m^V)$ |
|
|
179
|
+
| **21** | Graph Coloring | Backtracking | `GC - Interference` | $O(V \cdot m^V)$ |
|
|
180
|
+
| **22** | LC Branch and Bound | State Space Search | `LC - Delivery` | $O(n! \cdot n^2)$ |
|
|
181
|
+
| **23** | LC Branch and Bound | State Space Search | `LC - Flight` | $O(n! \cdot n^2)$ |
|
|
182
|
+
| **24** | LC Branch and Bound | State Space Search | `LC - Drilling` | $O(n! \cdot n^2)$ |
|
|
168
183
|
|
|
169
184
|
---
|
|
170
185
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ⚡ DanceAlgorithm
|
|
2
2
|
|
|
3
3
|
> **Instant DAA Problem Sheets, Datasets, Solutions & Algorithm Vault**
|
|
4
|
-
> Download, extract, organize, and directly **import** all
|
|
4
|
+
> Download, extract, organize, and directly **import** all 24 Design & Analysis of Algorithms (DAA) lab practical problem sheets, datasets, and Java solutions cleanly onto your PC or Linux machine with a single command or Python import.
|
|
5
5
|
|
|
6
6
|
[](https://pypi.org/project/dancealgorithm/)
|
|
7
7
|
[](https://www.python.org/)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
## 🌟 The Magic Experience
|
|
15
15
|
|
|
16
|
-
### Option A: Install & Extract All
|
|
16
|
+
### Option A: Install & Extract All 24 Problem Sheets
|
|
17
17
|
|
|
18
18
|
```powershell
|
|
19
19
|
pip install dancealgorithm; dance
|
|
@@ -25,7 +25,7 @@ Or run `dance` (or `dancealgorithm`) anytime in your terminal:
|
|
|
25
25
|
dance
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Your `C:\DAA_Assignments` folder (or `~/DAA_Assignments` on Linux) is cleanly populated with all
|
|
28
|
+
Your `C:\DAA_Assignments` folder (or `~/DAA_Assignments` on Linux) is cleanly populated with all 24 problem sheets:
|
|
29
29
|
|
|
30
30
|
```text
|
|
31
31
|
C:\DAA_Assignments\
|
|
@@ -35,9 +35,10 @@ C:\DAA_Assignments\
|
|
|
35
35
|
├── MS - Commerce/
|
|
36
36
|
│ ├── dataset.csv
|
|
37
37
|
│ └── Solution.java
|
|
38
|
-
├── MS - Library/
|
|
39
38
|
├── ...
|
|
40
|
-
|
|
39
|
+
├── GC - University/
|
|
40
|
+
│ └── Solution.java
|
|
41
|
+
└── LC - Drilling/
|
|
41
42
|
└── Solution.java
|
|
42
43
|
```
|
|
43
44
|
|
|
@@ -67,9 +68,15 @@ dance K.txt
|
|
|
67
68
|
|
|
68
69
|
# Multistage Graph backward DP
|
|
69
70
|
dance MSG.txt
|
|
71
|
+
|
|
72
|
+
# Graph Coloring backtracking analysis
|
|
73
|
+
dance GC.txt
|
|
74
|
+
|
|
75
|
+
# TSP - Least Cost Branch & Bound analysis
|
|
76
|
+
dance LC.txt
|
|
70
77
|
```
|
|
71
78
|
|
|
72
|
-
*(You can also use `dancealgorithm DA.txt` or `dance DA`)*
|
|
79
|
+
*(You can also use `dancealgorithm DA.txt`, `dance GC.txt`, or `dance DA`)*
|
|
73
80
|
|
|
74
81
|
### 2. Extract a Specific Assignment Folder
|
|
75
82
|
|
|
@@ -79,12 +86,14 @@ Extract only that particular folder:
|
|
|
79
86
|
# Extract unquoted or quoted
|
|
80
87
|
dance MSG - Logistics
|
|
81
88
|
dance "DA - Smart"
|
|
82
|
-
dance "
|
|
89
|
+
dance "GC - Classroom"
|
|
90
|
+
dance "LC - Delivery"
|
|
83
91
|
|
|
84
92
|
# Or extract by problem number
|
|
85
93
|
dance 1
|
|
86
|
-
dance 10
|
|
87
94
|
dance 13
|
|
95
|
+
dance 19
|
|
96
|
+
dance 24
|
|
88
97
|
```
|
|
89
98
|
|
|
90
99
|
### 3. List All Available Problem Sheets & Notes
|
|
@@ -97,7 +106,7 @@ dance list
|
|
|
97
106
|
|
|
98
107
|
## 🐍 Option B: Direct Python Import
|
|
99
108
|
|
|
100
|
-
All
|
|
109
|
+
All 24 assignments can be directly inspected or extracted programmatically:
|
|
101
110
|
|
|
102
111
|
```python
|
|
103
112
|
import dancealgorithm
|
|
@@ -118,7 +127,7 @@ dancealgorithm.open_folder()
|
|
|
118
127
|
|
|
119
128
|
---
|
|
120
129
|
|
|
121
|
-
## 📚 Complete Catalogue of All
|
|
130
|
+
## 📚 Complete Catalogue of All 24 DAA Problem Sheets
|
|
122
131
|
|
|
123
132
|
| No. | Algorithm | Category | Problem Sheet Title | Time Complexity |
|
|
124
133
|
|---|---|---|---|---|
|
|
@@ -140,6 +149,12 @@ dancealgorithm.open_folder()
|
|
|
140
149
|
| **16** | 0/1 Knapsack | Dynamic Programming | `K - Disaster` | $O(n \cdot W)$ |
|
|
141
150
|
| **17** | 0/1 Knapsack | Dynamic Programming | `K - Hospital` | $O(n \cdot W)$ |
|
|
142
151
|
| **18** | 0/1 Knapsack | Dynamic Programming | `K - Cloud` | $O(n \cdot W)$ |
|
|
152
|
+
| **19** | Graph Coloring | Backtracking | `GC - University` | $O(V \cdot m^V)$ |
|
|
153
|
+
| **20** | Graph Coloring | Backtracking | `GC - Classroom` | $O(V \cdot m^V)$ |
|
|
154
|
+
| **21** | Graph Coloring | Backtracking | `GC - Interference` | $O(V \cdot m^V)$ |
|
|
155
|
+
| **22** | LC Branch and Bound | State Space Search | `LC - Delivery` | $O(n! \cdot n^2)$ |
|
|
156
|
+
| **23** | LC Branch and Bound | State Space Search | `LC - Flight` | $O(n! \cdot n^2)$ |
|
|
157
|
+
| **24** | LC Branch and Bound | State Space Search | `LC - Drilling` | $O(n! \cdot n^2)$ |
|
|
143
158
|
|
|
144
159
|
---
|
|
145
160
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dancealgorithm"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.2"
|
|
8
8
|
description = "DanceAlgorithm: Instant DAA Algorithms, Lab Problem Sheets, Datasets, and Code Vault."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""
|
|
2
2
|
DanceAlgorithm - Instant DAA Algorithms, Lab Problem Sheets, Datasets & Code Vault.
|
|
3
|
-
All
|
|
3
|
+
All 24 Practical Exam Problem Sheets & Algorithm Notes Bundled & Instantly Importable.
|
|
4
4
|
"""
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -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.
|
|
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
|
|
@@ -128,4 +128,4 @@ __all__ = [
|
|
|
128
128
|
"extract",
|
|
129
129
|
"open_folder",
|
|
130
130
|
]
|
|
131
|
-
|
|
131
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
PATH = Path(__file__).resolve().parent
|
|
7
|
+
DIR = PATH
|
|
8
|
+
JAVA_SOLUTION = PATH / "Solution.java"
|
|
9
|
+
DATASET_PATH = PATH / "dataset.csv"
|
|
10
|
+
TITLE = "GC - Classroom"
|
|
11
|
+
|
|
12
|
+
def get_code() -> str:
|
|
13
|
+
if JAVA_SOLUTION.exists():
|
|
14
|
+
return JAVA_SOLUTION.read_text(encoding="utf-8")
|
|
15
|
+
return ""
|
|
16
|
+
|
|
17
|
+
def extract(destination: Optional[str | Path] = None, overwrite: bool = True) -> Path:
|
|
18
|
+
from dancealgorithm.downloader import extract_bundled
|
|
19
|
+
from dancealgorithm.config import get_destination
|
|
20
|
+
target = Path(destination) if destination else get_destination()
|
|
21
|
+
extract_bundled(target, subject_filter=TITLE, overwrite=overwrite)
|
|
22
|
+
return target / PATH.name
|
|
23
|
+
|
|
24
|
+
def open_folder() -> None:
|
|
25
|
+
import os
|
|
26
|
+
if sys.platform == "win32":
|
|
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 &')
|
|
32
|
+
|
|
33
|
+
def __getattr__(name: str):
|
|
34
|
+
if name in ("code", "java_code", "solution_code"):
|
|
35
|
+
return get_code()
|
|
36
|
+
if name in ("path", "folder", "dir"):
|
|
37
|
+
return PATH
|
|
38
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
PATH = Path(__file__).resolve().parent
|
|
7
|
+
DIR = PATH
|
|
8
|
+
JAVA_SOLUTION = PATH / "Solution.java"
|
|
9
|
+
DATASET_PATH = PATH / "dataset.csv"
|
|
10
|
+
TITLE = "GC - Interference"
|
|
11
|
+
|
|
12
|
+
def get_code() -> str:
|
|
13
|
+
if JAVA_SOLUTION.exists():
|
|
14
|
+
return JAVA_SOLUTION.read_text(encoding="utf-8")
|
|
15
|
+
return ""
|
|
16
|
+
|
|
17
|
+
def extract(destination: Optional[str | Path] = None, overwrite: bool = True) -> Path:
|
|
18
|
+
from dancealgorithm.downloader import extract_bundled
|
|
19
|
+
from dancealgorithm.config import get_destination
|
|
20
|
+
target = Path(destination) if destination else get_destination()
|
|
21
|
+
extract_bundled(target, subject_filter=TITLE, overwrite=overwrite)
|
|
22
|
+
return target / PATH.name
|
|
23
|
+
|
|
24
|
+
def open_folder() -> None:
|
|
25
|
+
import os
|
|
26
|
+
if sys.platform == "win32":
|
|
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 &')
|
|
32
|
+
|
|
33
|
+
def __getattr__(name: str):
|
|
34
|
+
if name in ("code", "java_code", "solution_code"):
|
|
35
|
+
return get_code()
|
|
36
|
+
if name in ("path", "folder", "dir"):
|
|
37
|
+
return PATH
|
|
38
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,119 @@
|
|
|
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 courses: ");
|
|
10
|
+
int iSize = sc.nextInt();
|
|
11
|
+
|
|
12
|
+
String sCourses[] = new String[iSize];
|
|
13
|
+
|
|
14
|
+
// 2. Get Course Names
|
|
15
|
+
sc.nextLine();
|
|
16
|
+
|
|
17
|
+
for (int iCnt = 0; iCnt < iSize; iCnt++) {
|
|
18
|
+
System.out.print("Enter course " + (iCnt + 1) + ": ");
|
|
19
|
+
sCourses[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 course numbers for conflict pair " + (iCnt + 1));
|
|
30
|
+
|
|
31
|
+
System.out.print("First course: ");
|
|
32
|
+
int iU = sc.nextInt() - 1;
|
|
33
|
+
|
|
34
|
+
System.out.print("Second course: ");
|
|
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 course numbers!");
|
|
43
|
+
iCnt--;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 4. Get Available Exam Slots
|
|
48
|
+
System.out.print("\nEnter available exam slots: ");
|
|
49
|
+
int iSlots = sc.nextInt();
|
|
50
|
+
|
|
51
|
+
// 5. Apply Graph Coloring
|
|
52
|
+
TimetableScheduler(iGraph, iSlots, sCourses);
|
|
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 iSlots,
|
|
71
|
+
int iColor[], int iV, int iSize) {
|
|
72
|
+
if (iV == iSize) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
for (int iC = 1; iC <= iSlots; iC++) {
|
|
77
|
+
if (IsSafe(iV, iGraph, iColor, iC, iSize)) {
|
|
78
|
+
iColor[iV] = iC;
|
|
79
|
+
|
|
80
|
+
if (GraphColoring(iGraph, iSlots, 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. Timetable Scheduler
|
|
94
|
+
static void TimetableScheduler(int iGraph[][],
|
|
95
|
+
int iSlots, String sCourses[]) {
|
|
96
|
+
int iSize = sCourses.length;
|
|
97
|
+
int iColor[] = new int[iSize];
|
|
98
|
+
|
|
99
|
+
System.out.println("\nUniversity Exam Timetable:");
|
|
100
|
+
System.out.println("------------------------------------------------");
|
|
101
|
+
|
|
102
|
+
if (!GraphColoring(iGraph, iSlots, iColor, 0, iSize)) {
|
|
103
|
+
System.out.println("No conflict-free schedule possible!");
|
|
104
|
+
} else {
|
|
105
|
+
System.out.printf("%-30s %-15s%n",
|
|
106
|
+
"Course Name", "Exam Slot");
|
|
107
|
+
|
|
108
|
+
System.out.println("------------------------------------------------");
|
|
109
|
+
|
|
110
|
+
for (int iCnt = 0; iCnt < iSize; iCnt++) {
|
|
111
|
+
System.out.printf("%-30s Slot %d%n",
|
|
112
|
+
sCourses[iCnt], iColor[iCnt]);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
System.out.println("------------------------------------------------");
|
|
116
|
+
System.out.println("Status: All courses scheduled without clashes.");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|