0% found this document useful (0 votes)
30 views8 pages

Environmental PDF

Environmental science

Uploaded by

Onkar Kakde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views8 pages

Environmental PDF

Environmental science

Uploaded by

Onkar Kakde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

### **Task Management System**

A program that helps users manage tasks for a week while incorporating
**searching, sorting, and linked list functionalities**. Users can add tasks,
track their completion status, and analyze their performance.

### **Features**

1. **Task Management**:

- Add tasks with descriptions and deadlines.

- Mark tasks as complete or incomplete for each day of the week.

2. **Sorting Options**:

- **Insertion Sort**: Sort tasks alphabetically.

- **Quick Sort**: Sort tasks by deadlines (earliest to latest).

3. **Search Functionality**:

- **Binary Search**: Find a specific task by its name.

4. **Analysis Tools**:

- Identify the **most completed tasks** (highest weekly completion) and


**least completed tasks**.

5. **Linked Lists**:

- Use **singly linked lists** for dynamically adding and managing tasks.

- Use **doubly linked lists** for advanced navigation between tasks.


6. **Weekly Summary**:

- Show a detailed report of tasks, their statuses, and their completion rates.

### **How It Works**

1. **Add Tasks**:

- Users add tasks with a name and optional deadline. Tasks are stored
dynamically using linked lists.

2. **Track Completion**:

- Users can mark tasks as complete or incomplete for each day of the
week.

3. **Sorting**:

- Tasks can be sorted alphabetically or by deadlines for better organization.

4. **Search**:

- Quickly search for a task by its name using Binary Search (after sorting
alphabetically).

5. **Task Analysis**:

- The system evaluates which tasks were completed the most and which
were least completed during the week.

### **Benefits**

- **Personal Organization**: Helps users stay on top of their weekly tasks and
deadlines.
- **Efficient Tools**: Sorting and searching improve accessibility and usability.

- **Educational**: Reinforces data structure and algorithm concepts.

- **Dynamic Memory Usage**: Linked lists make the system more scalable
and efficient.

### **Sample C++ Code**

Here’s a simplified version of the **Task Management System** to give you a


clear understanding of its implementation.

```cpp

#include <iostream>

#include <vector>

#include <string>

#include <algorithm>

Using namespace std;

// Task structure

Struct Task {

String name;

String deadline; // Optional deadline

Vector<bool> progress; // Completion status for 7 days

};

// Function to add a task

Void addTask(vector<Task>& tasks, const string& name, const string&


deadline) {
Tasks.push_back({name, deadline, vector<bool>(7, false)});

Cout << “Task \”” << name << “\” added with deadline: “ << deadline
<< “\n”;

// Function to mark progress

Void markTask(vector<Task>& tasks, int taskIndex, int day) {

If (taskIndex < 0 || taskIndex >= tasks.size() || day < 1 || day > 7) {

Cout << “Invalid input.\n”;

Return;

Tasks[taskIndex].progress[day – 1] = true;

Cout << “Marked progress for \”” << tasks[taskIndex].name << “\” on
day “ << day << “.\n”;

// Function to display weekly summary

Void showSummary(const vector<Task>& tasks) {

Cout << “\n--- Weekly Summary ---\n”;

For (const auto& task : tasks) {

Cout << “Task: “ << task.name << “ | Deadline: “ << task.deadline


<< “\nProgress: “;

For (bool day : task.progress)

Cout << (day ? “✔ “ : “✘ “);

Cout << “\n”;

}
// Insertion sort for sorting tasks alphabetically

Void insertionSort(vector<Task>& tasks) {

For (size_t I = 1; I < tasks.size(); ++i) {

Task key = tasks[i];

Int j = I – 1;

While (j >= 0 && tasks[j].name > key.name) {

Tasks[j + 1] = tasks[j];

--j;

Tasks[j + 1] = key;

Cout << “Tasks sorted alphabetically.\n”;

// Binary search to find a task

Int binarySearch(const vector<Task>& tasks, const string& target) {

Int left = 0, right = tasks.size() – 1;

While (left <= right) {

Int mid = left + (right – left) / 2;

If (tasks[mid].name == target)

Return mid;

If (tasks[mid].name < target)

Left = mid + 1;

Else

Right = mid – 1;

Return -1; // Task not found


}

// Main function

Int main() {

Vector<Task> tasks;

Int choice;

Do {

Cout << “\n--- Task Management System ---\n”;

Cout << “1. Add Task\n”;

Cout << “2. Mark Task Progress\n”;

Cout << “3. Show Weekly Summary\n”;

Cout << “4. Sort Tasks Alphabetically\n”;

Cout << “5. Search Task\n”;

Cout << “6. Exit\n”;

Cout << “Enter your choice: “;

Cin >> choice;

Switch (choice) {

Case 1: {

String name, deadline;

Cout << “Enter task name: “;

Cin.ignore();

Getline(cin, name);

Cout << “Enter deadline (optional): “;

Getline(cin, deadline);

addTask(tasks, name, deadline);


break;

Case 2: {

Int index, day;

Cout << “Enter task index (0 to “ << tasks.size() – 1 << “): “;

Cin >> index;

Cout << “Enter day of the week (1 to 7): “;

Cin >> day;

markTask(tasks, index, day);

break;

Case 3:

showSummary(tasks);

break;

case 4:

insertionSort(tasks);

break;

case 5: {

string target;

cout << “Enter task name to search: “;

cin.ignore();

getline(cin, target);

int result = binarySearch(tasks, target);

if (result != -1)

cout << “Task found at index “ << result << “: “ <<


tasks[result].name << “\n”;

else
cout << “Task not found.\n”;

break;

Case 6:

Cout << “Exiting Task Management System. Stay organized!\n”;

Break;

Default:

Cout << “Invalid choice. Try again.\n”;

} while (choice != 6);

Return 0;

```

---

You might also like