================================================================================ DATA STRUCTURES AND ALGORITHMS ASSIGNMENT 10: Student Records Management System State University of Zanzibar (SUZA) ================================================================================ ANTI-PLAGIARISM NOTICE: This assignment requires LIVE DEMONSTRATION (viva). You must: 1. Explain every function in your code 2. Modify your code on the spot when asked 3. Answer questions about your design choices 4. Submit a HANDWRITTEN design document AI-generated or copied code will result in ZERO marks. ================================================================================ PROJECT DESCRIPTION ================================================================================ Build a Student Records Management System that uses sorting and searching algorithms to organize, query, and analyze student data. The system must support multiple sorting criteria and efficient search operations. ================================================================================ REQUIREMENTS ================================================================================ DATA STRUCTURE: #define MAX_STUDENTS 500 struct Student { char name[50]; char regNo[20]; // Registration number (e.g., "BSCS-2023-001") float gpa; // 0.0 to 4.0 int age; float scores[5]; // 5 course scores }; struct Student students[MAX_STUDENTS]; int studentCount = 0; PART 1: DATA MANAGEMENT (20 marks) 1. Add Student void addStudent(); - Read name, regNo, age, and 5 course scores - Calculate GPA automatically from scores - Validate: GPA 0-4, age 16-60, regNo format check 2. Display All Students void displayAll(); - Formatted table: | # | Name | Reg. No. | GPA | Age | |---|------------------|-----------------|------|-----| | 1 | Ali Hassan | BSCS-2023-001 | 3.45 | 20 | | 2 | Fatma Said | BSCS-2023-002 | 3.78 | 21 | 3. Load from File void loadFromFile(char filename[]); - CSV format: Name,RegNo,Age,Score1,Score2,Score3,Score4,Score5 4. Save to File void saveToFile(char filename[]); - Save in same CSV format PART 2: SORTING (30 marks) Implement sorting by different criteria: 5. Sort by Name (Alphabetical) void sortByName(); - Use Insertion Sort (stable sort for names) 6. Sort by GPA (Descending - highest first) void sortByGPA(); - Use Merge Sort (efficient for large datasets) 7. Sort by Registration Number void sortByRegNo(); - Use Quick Sort 8. Sort by Age void sortByAge(); - Use Selection Sort For each sort: - Display the array before and after sorting - Show number of comparisons made - Allow ascending/descending choice 9. Multi-field Sort void sortByGPAThenName(); - Primary: GPA descending - Secondary: Name alphabetical (for same GPA) PART 3: SEARCHING (25 marks) 10. Search by Registration Number (Binary Search) int searchByRegNo(char regNo[]); - Array must be sorted by regNo first - Return index or -1 - Display search steps (low, high, mid at each step) 11. Search by Name (Linear Search) void searchByName(char name[]); - Support partial matching (substring) - Display all matches - Example: search "Ali" matches "Ali Hassan", "Alisha Khamis" 12. Search by GPA Range void searchByGPARange(float minGPA, float maxGPA); - Display all students within range - Use binary search to find range boundaries (array sorted by GPA) PART 4: ANALYSIS & REPORTS (25 marks) 13. Generate Ranked List void generateRankList(); - Sort by GPA descending - Display with rank numbers - Handle ties (same rank for same GPA) 14. Top N Students void topNStudents(int n); - Display top n students by GPA - Use partial Quick Sort (Quick Select) for efficiency 15. Statistics Report void generateStats(); - Average GPA of class - Highest and lowest GPA (with student names) - GPA distribution: 4.0-3.5: ## students 3.5-3.0: ## students 3.0-2.5: ## students Below 2.5: ## students - Average score per course 16. Save Report to File void saveReport(char filename[]); - Generate complete report to text file ================================================================================ MENU INTERFACE ================================================================================ === Student Records Management System === Students loaded: [count] --- Data Management --- 1. Add student 2. Display all students 3. Load from file 4. Save to file --- Sorting --- 5. Sort by name 6. Sort by GPA 7. Sort by registration number 8. Sort by age --- Searching --- 9. Search by registration number 10. Search by name 11. Search by GPA range --- Reports --- 12. Ranked list 13. Top N students 14. Statistics report 15. Save report to file 0. Exit ================================================================================ TEST DATA ================================================================================ Create a file "students.csv" with at least 20 students. Use realistic Zanzibari names and registration numbers. Example: Ali Hassan,BSCS-2023-001,20,75,82,90,68,71 Fatma Said,BSCS-2023-002,21,88,92,85,79,95 Omar Juma,BSCS-2023-003,19,65,70,72,60,68 Amina Khamis,BSCS-2023-004,22,90,88,92,95,87 ... ================================================================================ HANDWRITTEN DESIGN DOCUMENT (Required) ================================================================================ Submit on paper: 1. Explain why you chose each sorting algorithm for each criteria 2. Trace binary search for a specific registration number 3. Draw the struct layout in memory for one Student record 4. Explain how multi-field sorting works (GPA then Name) 5. What is the time complexity of your searchByGPARange using binary search? ================================================================================ GRADING RUBRIC ================================================================================ | Component | Marks | |-------------------------------|-------| | Data management (add/display) | 10 | | File I/O (load/save) | 10 | | Sorting (4 algorithms) | 30 | | Searching (3 methods) | 25 | | Reports & analysis | 15 | | Handwritten design document | 10 | | Total | 100 | Viva Demonstration: Required (multiplier: 0 or 1) ================================================================================ VIVA QUESTIONS: ================================================================================ 1. Why did you use Insertion Sort for names and Merge Sort for GPA? 2. Demonstrate sorting by a different field (e.g., by total score) - live. 3. What is the time complexity of your ranked list generation? 4. How does your partial matching name search work? 5. Add a "delete student" feature that maintains sorted order - live. 6. What would happen if two students have the same registration number? 7. How would you implement pagination (show 10 students per page)? ================================================================================