Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views22 pages

Dsa Report

Contains report in Cash flow Minimiser

Uploaded by

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

Dsa Report

Contains report in Cash flow Minimiser

Uploaded by

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

K. L. E.

SOCIETY’S
K. L. E. INSTITUTE OF TECHNOLOGY,
Opp. Airport, Gokul, Hubballi-580 027
Phone: 0836-2232681 Website: www.kleit.ac.in

A Mini Project Report on

“Cash Flow Minimiser”

Computer Science and Engineering


Semester III
Data Structures And Applications (BCS304)
Academic Year 2024-25

Submitted By
Mr. Gagan Ashok Marer
(USN: 2KE23CS039)

Mr. G Bhuvan
(USN: 2KE23CS038)

Mr. Bhuvan Pattar


(USN: 2KE23CS026)

Mr. Shivkumar S H
(USN: 2KE22CS138)

Under the Guidance of

Mrs.Vijeeta Patil.

1
Department of Computer Science & Engineering

K. L. E. SOCIETY’S
K. L. E. INSTITUTE OF TECHNOLOGY,
Opp. Airport, Gokul, Hubballi-580 027
Phone: 0836-2232681 Website: www.kleit.ac.in

CERTIFICATE

Certified that the mini project work entitle “Cash Flow Minimiser” is a bonafide
work carried out by Mr. Gagan A M, G Bhuvan, Bhuvan Pattar, Shivkumar S H bearing
USN number 2KE23CS039, 2KE23CS038, 2KE23CS028, 2KE22CS138, in partial

fulfillment for the award of degree of Bachelor of Engineering in Semester III ,


Computer Science and Engineering of Visvesvaraya Technological University,
Belagavi, during the year 2024-25. It is certified that all corrections/suggestions indicated
for internal assessment have been incorporated in the report deposited in the department
library.

Signature of the Guide


(Mrs.Vijeeta Patil)

2
ACKNOWLEDGEMENT

The mini project report on “Cash Flow Minimiser” is the outcome of guidance,
moral support and devotion bestowed on me throughout my work. For this I
acknowledge and express my profound sense of gratitude and thanks to everybody who
have been a source of inspiration during the project work.
First and foremost I offer my sincere phrases of thanks with innate humility to our
Principal Dr. Manu T M who has been a constant source of support and
encouragement. I would like to thank our Dean Academics Dr. Yerriswamy T for his
constant support and guidance. I feel deeply indebted to our H.O.D.Rajesh
Yakkundimath. for the right help provided from the time of inception till date. I
would take this opportunity to acknowledge our Guide Mrs.Vijeeta Patil.
who not only stood by us as a source of inspiration, but also dedicated his/her time for
me to enable me to present the project on time.
Last but not least, I would like to thank my parents, friends & well wishers who have
helped me in this work.

Name of the Students….


Mr. Gagan A M

Mr.G Bhuvan

Mr.Bhuvan Pattar

Mr.Shivkumar S H

3
INDEX

Contents Page no.

1. INTRODUCTION....................................................................... 5
1.1 Project Overview
1.2 Introduction to Data Structures And Applications
1.3 Application of Data Structures in project
1.4 Flowchart and Algorithm

2. Project Definition (Purpose and scope)........................ 12


3. Program Tracing (With Explanation of test cases)................... 13
4. Requirements (Hardware and Software)....................... 15
5. Implementation (Program and Output).......................... 23
6. Snapshots............................................................................ 26
7. Conclusion---------------------------------------------------------------- 28

REFERENCES(Text book names)........................................... 29

4
1. INTRODUCTION.

1.1 Project Overview


The E-commerce Project Management System is designed to streamline and
automate essential operations within an e-commerce platform. This system
primarily focuses on managing product inventory, handling customer orders,
and organizing these orders in a queue for efficient processing. Implemented in
C, this project demonstrates fundamental data structures like linked lists and
queues to manage product records and order operations effectively.
In this project:

1. Product Management:
o Users can add, display, search, and delete products from the inventory.
Each product record includes a unique ID, name, price, and quantity.
The linked list structure facilitates efficient management of the
inventory by enabling dynamic addition and deletion of products.

2. Order Queue Management:


o Orders are managed using a queue structure, which operates on a first-
come, first-served basis. This feature allows products to be enqueued
into an order queue and processed in sequence. The order management
functions include adding orders to the queue, viewing current orders,
and processing orders by dequeuing them.

3. Purpose and Scope:


o The purpose of the project is to provide a simple yet functional backend
system for managing an e-commerce business's inventory and order
processing. This system highlights essential concepts in data structures
and C programming, including memory management with malloc and
free, pointers, and struct-based data organization.

5
1.2 Introduction to Data Structures and Algorithms (DSA):

Data Structures and Algorithms (DSA) form the backbone of efficient


problem-solving in computer science. They provide standardized ways to store,
organize, and manage data, making it easier to access and manipulate
information as needed by different applications.

Importance of DSA in Software Development.

1. Efficiency: DSA helps in improving the efficiency of software, allowing for


faster data processing and retrieval. Efficient algorithms minimize the use of
resources like memory and CPU time, which is crucial in real-world
applications like e-commerce systems.
2. Scalability: Well-implemented data structures and algorithms make systems
scalable, allowing them to handle a large number of records or operations, such
as managing an expanding inventory or a growing queue of orders in an e-
commerce platform.
3. Problem-Solving Framework: DSA provides a foundation for structuring and
analyzing complex problems, enabling developers to break down tasks into
manageable components. This approach is particularly useful for projects
involving data management, where tasks like searching, sorting, and deleting
records are common.
Key Data Structures and Algorithms Used in This Project
1. Linked List:
o A linked list is a dynamic data structure ideal for managing a list of
items where additions and deletions are frequent. In this project, a linked
list is used to handle the product inventory. Each product node contains
details such as ID, name, price, and quantity, enabling flexible insertion
and deletion of products from the list.

2. Queue:
o A queue follows the First-In-First-Out (FIFO) principle and is perfect
for managing tasks that need sequential processing. In this project, a
6
queue is used for order management, ensuring that orders are processed
in the same order they were added, which mirrors real-world e-
commerce order processing.
3. Algorithms for Searching and Deleting:
o The project incorporates basic search and deletion algorithms to locate
products by ID and remove specific records from the inventory. These
algorithms demonstrate the practical application of DSA concepts in
building interactive, user-friendly applications.

1.3 Applications of DSA in E-commerce Project Management System:

1. Inventory Management with Linked Lists


o Dynamic Data Handling: A linked list structure allows the inventory to
expand and contract dynamically as products are added or removed,
making it a suitable choice for managing a frequently updated list.
o Efficient Insertion and Deletion: Linked lists facilitate efficient
insertion and deletion operations. When products need to be removed or
updated in the inventory, linked lists enable these modifications with
minimal rearrangement of data, which helps maintain performance.
o Product Search: By traversing the linked list, the program can search
for products by unique IDs, enhancing the flexibility and control users
have over the inventory.
2. Order Queue Management Using Queues
o Order Processing: In e-commerce systems, orders need to be processed
in the same order they are placed, following the First-In-First-Out (FIFO)
principle. A queue data structure provides this functionality, ensuring
that orders are fulfilled in sequence.
o Simplicity in Order Handling: The queue’s structure makes adding
(enqueue) and processing (dequeue) orders straightforward, allowing the
program to handle order processing in a way that mirrors real-world
business practices.
o Organized Workflow: By utilizing a queue for orders, this project
maintains an organized workflow that prevents overlooked or skipped

7
orders, contributing to smoother operations and customer satisfaction.
3. Application of Algorithms for Search, Addition, and Deletion
o Search Algorithm: The search functionality allows users to locate
products based on specific criteria, such as ID. This is critical in
inventory management where quick retrieval of product details is
essential.
o Deletion Algorithm: The deletion algorithm in the linked list allows
products to be removed efficiently without affecting the overall
structure of the inventory, which is essential in maintaining data
integrity.
4. Scalability and Efficiency
o The use of linked lists and queues makes this system scalable, as new
products or orders can be added without significantly impacting
system performance. This scalability is essential in e-commerce
applications, where product lines and customer demand often grow
over time.
o Efficient data structures ensure that operations on large data sets (like
a vast inventory or high order volume) remain responsive and
manageable, improving user experience.
1.4 Algorithem and Flowchart

1. Compute the net amount for every person. The net amount for person ‘i’ can be
computed by subtracting sum of all debts from sum of all credits.
2. Find the two persons that are maximum creditor and maximum debtor. Let the
maximum amount to be credited maximum creditor be maxCredit and maximum
amount to be debited from maximum debtor be maxDebit. Let the maximum debtor
be Pd and maximum creditor be Pc.
3. Find the minimum of maxDebit and maxCredit. Let minimum of two be x.
Debit ‘x’ from Pd and credit this amount to Pc
4. If x is equal to maxCredit, then remove Pc from set of persons and recur for
remaining (n-1) persons.
5. If x is equal to maxDebit, then remove Pd from set of persons and recur for
remaining (n-1) persons.

8
9
2. Project Definition (Purpose and Scope)
Purpose:
The purpose of the E-commerce Project Management System is toIn liberalized electricity markets, it is
common for electricity retailing companies to purchase spot electricity through the central power
exchange and deliver it to their consumers (or demanders). On the other hand, power generation
companies place sales
orders on power exchange and produce electricity based on the executed volume. In this situation, their
profit or loss may depend on the cashflows defined by the product of spot electricity price and volume.
In this section, we introduce the minimum variance hedging problems to mitigate cashflow fluctuations
for power retailers and generators.

Scope:
The scope of this project covers the core functionalities required in a basic e-commerce
management system:
1. Inventory Operations:
o Adding Products: Users can input product details (ID, name, price,
quantity) to dynamically expand the inventory list.
o Displaying loans: The entire product inventory can be viewed, listing
each product's ID, name, price, and quantity.
o Searching for Products: Users can search for a specific product by ID,
allowing quick access to specific item details within the inventory.
o Deleting Products: Products can be removed from the inventory based
on their ID, which is useful for keeping the inventory up-to-date.
2. Order Management Operations:
o Enqueuing Orders: Products can be added to an order queue, simulating
a customer's order being placed.

10
o Dequeuing Orders: Orders are processed in a first-in-first-out manner,
ensuring that orders are handled in the order they were received.
o Viewing Order Queue: Users can view all orders in the queue, which
provides transparency and assists in tracking pending orders.
3. Data Structures and Algorithms:
o The project utilizes a linked list for inventory management, allowing
dynamic addition and deletion of products.
o A queue data structure is used to manage orders in a sequential
processing order.
o Basic algorithms for searching and deletion are applied to optimize
interactions with the inventory and orders.

1. Program Tracing (with Explanation of Test Cases)

Program Structure:
 Begin by describing the core functions:
o addProduct: Adds a new product to the list.
o displayProducts: Displays all products in the list.
o searchProduct: Finds a product by ID.
o deleteProduct: Deletes a product from the list.
o enqueueOrder: Adds a product to the order queue.
o dequeueOrder: Processes an order (removes it from the queue).
o printQueue: Displays the current order queue.
 Detailed Function Walkthrough with Test Cases:
 For each function, describe how it works and give a test case.
Example Format for Each Function:
Function Name: addProduct
 Purpose: Adds a new product to the linked list.
 Input:
o Product ID: integer
o Product Name: string
11
o Product Price: float
o Product Quantity: integer
 Algorithm:
o Allocate memory for a new product node.
o Populate the node with user inputs.
o Insert the node at the beginning of the list.
 Test Case:
o Input:
 Product ID: 101
 Product Name: Laptop
 Product Price: 75000.50
 Product Quantity: 10
o Expected Output: "Product added successfully."
o Result: Product with ID 101 is added to the linked list and can be
displayed in the product list.
Function Name: searchProduct
 Purpose: Searches for a product by ID in the linked list.
 Input:
o Product ID: integer
 Algorithm:
o Traverse the linked list to find the product with the specified ID.
o If found, display product details; otherwise, print "Product not found."
 Test Case:
o Input: Product ID: 101
o Expected Output: "Product found: ID: 101, Name: Laptop, Price:
75000.50, Quantity: 10."
o Result: Displays the details of the product with ID 101 if it exists.

Function Name: enqueueOrder


 Purpose: Adds a product to the order queue.
 Input:
o Product pointer (pointer to the product node being ordered)
 Algorithm:

12
o Create a new queue node containing the product.
o If the queue is empty, set the front and rear pointers to this node.
o Otherwise, add it to the end of the queue and update the rear pointer.
 Test Case:
o Input: Product pointer to the product with ID 101.
o Expected Output: "Product added to order queue."
o Result: Product is added to the queue and appears when printQueue is
called.

Testing Summary:
 Briefly summarize the results of each test case, confirming that the program
works as expected for adding, deleting, and processing products.

4. Requirements (Hardware and Software)


4.1 Hardware Requirements:
The hardware specifications required to run and develop this e-commerce project
management system are as follows:
 Processor: A processor with at least a 1 GHz clock speed (e.g., Intel i3, AMD
Ryzen 3, or equivalent).
 RAM: A minimum of 2 GB RAM is recommended for smooth program
execution and development.
 Storage: At least 500 MB of free disk space to install development tools and
store the source code and project files.
 Display: A monitor with a minimum resolution of 1024x768 for comfortable
programming and testing.
 Input Devices: A keyboard and mouse for user interaction and coding.
4.2 Software Requirements
The following software is required for developing and running the project:
1. Operating System:
o Windows: Windows 7/8/10/11 or newer versions.
o Linux: Any distribution (e.g., Ubuntu, Fedora).
o macOS: macOS 10.15 (Catalina) or newer versions.

13
2. Compiler:
o GCC (GNU Compiler Collection): The project is developed in C, and
GCC is commonly used for compiling C programs.
 Windows: MinGW (Minimalist GNU for Windows) or Cygwin.
 Linux/macOS: GCC is typically pre-installed, or it can be easily
installed via package managers like apt (Ubuntu) or brew
(macOS).
3. IDE/Text Editor:
o Code::Blocks: A popular free IDE for C/C++ development.
o Dev-C++: Another simple and lightweight IDE for C/C++.
o Visual Studio Code: A versatile and widely used text editor with C/C++
extensions.
o Vim/Emacs: For experienced users comfortable with terminal-based
text editors.
4. Libraries:
o The project uses basic standard C libraries such as:
 stdio.h for input/output operations.
 stdlib.h for dynamic memory allocation.
 string.h for string manipulation functions.
5. Other Tools:
o Git: A version control tool for managing the source code and
collaborating with others.
o Textbook/Documentation: A reference for understanding data
structures and C programming (e.g., The C Programming Language by
Brian Kernighan and Dennis Ritchie).
4.3 Network Requirements (Optional)
 Internet Connection: Not strictly required for the program to run but is
necessary for downloading and installing development tools or libraries.

14
5. Implementation

Program Code:

#include <stdio.h>
#include <stdlib.h>

// Structure to hold the person ID and cash


typedef struct {
int person_id;
int cash;
} Transaction;

// Comparator function for the min heap (for debits)


int compareMin(const void *a, const void *b) {
Transaction *t1 = (Transaction *)a;
Transaction *t2 = (Transaction *)b;
return t1->cash - t2->cash;
}

// Comparator function for the max heap (for credits)


int compareMax(const void *a, const void *b) {
Transaction *t1 = (Transaction *)a;
Transaction *t2 = (Transaction *)b;
return t2->cash - t1->cash;
}

// Function to calculate the net balance for each person


void calculateBalance(int n, int graph[n][n], int balance[n]) {
for (int i = 0; i < n; ++i) {
balance[i] = 0;
for (int j = 0; j < n; ++j) {
balance[i] += graph[j][i] - graph[i][j];
}
}
}

// Function to solve the cash flow transactions


void solveTransaction(int n, int balance[n]) {
// Create arrays for the transactions: positive and negative balances
Transaction maxQ[n], minQ[n];
int maxCount = 0, minCount = 0;

// Segregate people with credit and debit


for (int i = 0; i < n; ++i) {
if (balance[i] > 0) {
maxQ[maxCount].person_id = i;
15
maxQ[maxCount].cash = balance[i];
maxCount++;
} else if (balance[i] < 0) {
minQ[minCount].person_id = i;
minQ[minCount].cash = balance[i];
minCount++;
}
}

// Sort the maxQ in descending order (credits) and minQ in ascending order (debits)
qsort(maxQ, maxCount, sizeof(Transaction), compareMax);
qsort(minQ, minCount, sizeof(Transaction), compareMin);

// Process the transactions


int i = 0, j = 0;
while (i < maxCount && j < minCount) {
int credit = maxQ[i].cash;
int debit = minQ[j].cash;

int transaction_value = credit + debit;


int debtor = minQ[j].person_id;
int creditor = maxQ[i].person_id;

int owed_amount = 0;

if (transaction_value == 0) {
owed_amount = credit;
i++;
j++;
} else if (transaction_value < 0) {
owed_amount = credit;
maxQ[i].cash = -transaction_value;
i++;
j++;
} else {
owed_amount = -debit;
minQ[j].cash = -transaction_value;
i++;
j++;
}

// Print the result


printf("Person %d pays %d to Person %d\n", debtor, owed_amount, creditor);
}
}

// Function to calculate the minimum cash flow for the given graph
void minCashFlow(int n, int graph[n][n]) {
int balance[n];
calculateBalance(n, graph, balance);
16
solveTransaction(n, balance);
}

int main() {
// Test case 1
int graph1[3][3] = {
{0, 1000, 2000},
{0, 0, 5000},
{0, 0, 0}
};
printf("Solution 1 :\n");
minCashFlow(3, graph1);

// Test case 2
int graph2[5][5] = {
{2, 63, 0, 85, 49},
{0, 76, 0, 0, 27},
{0, 0, 0, 17, 0},
{73, 32, 50, 6, 71},
{0, 86, 0, 0, 10}
};
printf("Solution 2 :\n");
minCashFlow(5, graph2);

return 0;
}

17
Output:

Solution 1 :

Person 2 pays 1000 to Person 1

Person 0 pays 2000 to Person 1

Solution 2 :

Person 2 pays 17 to Person 3

Person 0 pays 63 to Person 3

Person 1 pays 49 to Person 3

Person 4 pays 10 to Person 3

Person 1 pays 86 to Person 4

Person 0 pays 50 to Person 4

Person 0 pays 32 to Person 1

Person 0 pays 73 to Person 2

18
6. snapshots

19
7.Conclusion

The E-Commerce Project Management System developed in C programming


successfully demonstrates the use of fundamental data structures and algorithms in
managing an e-commerce platform. Through this project, several key goals were
achieved, including:
1. Efficient Product Management:
o The system allows for adding, deleting, searching, and displaying
products with ease, using a linked list data structure to manage product
details such as ID, name, price, and quantity.
2. Order Queue Management:
o The use of a queue to manage customer orders ensures that products are
processed in a first-in, first-out (FIFO) manner, providing a simple yet
effective order management system.
3. Practical Application of C Programming:
o The project served as an opportunity to apply C programming skills,
specifically in the areas of dynamic memory allocation, pointer
manipulation, and the use of structures to model real-world systems.
4. Challenges Faced:
o A significant challenge faced during development was ensuring proper
memory management, particularly when dynamically allocating memory
for product and queue structures. Ensuring no memory leaks occurred
was essential for the stability of the program.
5. Testing and Validation:
o The project was rigorously tested with various test cases for product
addition, order processing, and product deletion. The program
performed as expected, with all test cases passing successfully and the
system handling various user inputs effectively.

20
References (Textbook Names):

1. "The C Programming Language" by Brian W. Kernighan and Dennis M.


Ritchie
o This is the classic textbook on C programming, often referred to as
"K&R." It covers the fundamentals of C, including memory
management, pointers, and structs, which are essential for understanding
your program's operations.
2. "Data Structures and Algorithm Analysis in C" by Mark Allen Weiss
o This book provides a deep understanding of various data structures (like
linked lists and queues), which are critical for your project. It also covers
algorithm analysis and is great for anyone implementing data structures
in C.
3. "C Programming: A Modern Approach" by K. N. King
o A comprehensive guide for both beginner and intermediate C
programmers. It includes detailed explanations and examples on how to
use C to solve practical problems, which can be applied to your e-
commerce project.
4. "Algorithms in C" by Robert Sedgewick
o This book focuses on algorithms and their implementation in C. It’s
helpful for understanding how different data structures, such as queues
and linked lists, can be manipulated to solve complex problems, which
would be useful for your system.
5. "Understanding Data Structures and Algorithms with C" by S. R. M.
Prasad
o A focused text on implementing various data structures (like linked lists,
queues, stacks) and algorithms using C. It also explains how to solve
typical programming challenges related to data handling.
6. "Data Structures Using C" by Reema Thareja
o This book covers C programming along with various data structures,
such as stacks, queues, linked lists, and trees.

21
o

22

You might also like