0% found this document useful (0 votes)
2 views12 pages

inversion of arrays1

The document is a micro project report on 'Inversion of Arrays' submitted by students for their Bachelor of Technology degree in Mathematics & Computing. It details the development of an efficient algorithm using a modified Merge Sort to identify and count inversions in arrays, highlighting its significance in data analysis and sorting algorithms. The project emphasizes practical applications, challenges faced, and future improvements for the algorithm.

Uploaded by

24mc10am20
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)
2 views12 pages

inversion of arrays1

The document is a micro project report on 'Inversion of Arrays' submitted by students for their Bachelor of Technology degree in Mathematics & Computing. It details the development of an efficient algorithm using a modified Merge Sort to identify and count inversions in arrays, highlighting its significance in data analysis and sorting algorithms. The project emphasizes practical applications, challenges faced, and future improvements for the algorithm.

Uploaded by

24mc10am20
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/ 12

INVERSION OF ARRAYS

Micro Project Report

Submitted for the partial fulfillment of the degree of

Bachelor of Technology
In

Mathematics & Computing

Group No. : A18


Submitted By

ANEEKA DWIVEDI BTMC24O1025

KAUSHAL KAURAV BTMC24O1066

UNDER THE SUPERVISION AND GUIDANCE OF

DR.PRABHAKAR SHARMA SIR

Assistant Professor

Department of Engineering Mathematics & Computing

July- Dec 2024


DECLARATION BY THE CANDIDATES
We hereby declare that the work entitled “INVERSION OF ARRAYS ” is our work,
conducted under the supervision of DR.PRABHAKAR SHARMA, during the session
July-Dec 2024. The report submitted by us is a record of bonafide work carried out by us.

We further declare that the work reported in this report has not been submitted and will not be
submitted, either in part or in full, for the award of any other degree or diploma in this institute
or any other institute or university.

-------------------------------- --------------------------------
ANEEKA DWIVEDI KAUSHAL KAURAV
( BTMC24O1025) ( BTMC24O1066 )

Date: 26/12/2024
Place: Gwalior

This is to certify that the above statement made by the candidates is correct to the best of my
knowledge and belief.
Guided By:
______________
DR.PRABHAKAR SHARMA
Assistant Professor
Department of Engineering Mathematics and Computing
MITS, Gwalior

Departmental Project Coordinators Approved by HoD

_________________ _________________ ________________


Dr. Minakshi Dahiya Dr. Atul Kumar Ray Dr. D. K. Jain
Assistant Professor Assistant Professor Professor & Head
Department of Engineering Department of Engineering Department of Engineering
Mathematics and Computing Mathematics and Computing Mathematics and Computing
MITS, Gwalior MITS, Gwalior MITS, Gwalior

1
ACKNOWLEDGEMENT
It is my great pleasure to express sincere gratitude to my supervisor, DR. PRABHAKAR
SHARMA SIR for his expert guidance and constant encouragement. I acknowledge that it is
because of his interest that I enjoyed working on this project and express my earnest and
heartfelt thanks to him for his time, support and efforts.

I also thankful to all the faculties of the Department of Engineering Mathematics and
Computing for their encouragement, who had invested their valuable time in providing their
feedback with a lot of useful suggestions.

I are highly obliged to all my friends for their encouragement and for helping me at the points
where I got stuck. I am deeply indebted to all of them for always helping and inspiriting me.

-----------------------------
ANEEKA DWIVEDI BTMC24O1025

-----------------------------

KAUSHAL KAURAV BTMC24O1066

2
ABSTRACT
An inversion in an array occurs when a larger number appears before a smaller number. It
represents a pair of elements where the earlier element is greater than the later one.

The objective of the "Inversion of Array" project is to develop an efficient algorithm for
identifying and counting inversions within an array. It aims to design a robust algorithm that
accurately detects inversions while optimizing for time and resource efficiency.

we first define the problem and understand its significance. We then design an efficient
algorithm, such as one based on Merge Sort, to handle large datasets. After implementing the
algorithm with modular and well-documented code, we test it with various array sizes to ensure
correctness and efficiency.

The results of the "Inversion of Array" project include the successful development and
implementation of an efficient inversion-counting algorithm.The algorithm was tested with
various array sizes and demonstrated high accuracy and optimal performance.

This successfully highlights the significance of inversions in understanding array disorder and
improving sorting algorithms.

3
CONTENT

Table of Contents
Declaration by the Candidates ................................................................................................... 1

Acknowledgement ..................................................................................................................... 2

Abstract ...................................................................................................................................... 3

Content ....................................................................................................................................... 4

1: Introduction ............................................................................................................................ 5

2: System Requirement and methods ......................................................................................... 6

3: Implementation / Execution ................................................................................................... 7

4: Result and Discussion ............................................................................................................ 8

5 :Conclusion ............................................................................................................................. 9

7: References ............................................................................................................................ 10

6 : Appendices.......................................................................................................................... 11

4
1: INTRODUCTION

In order to count inversions in an array, we use a modified Merge Sort algorithm. This involves
dividing the array into two halves, sorting them recursively, and counting inversions during the
merge step. When merging, if an element from the left half is greater than an element from the
right half, it means all subsequent elements in the left half are also greater. The inversion count
increases by the number of remaining elements in the left half. This approach ensures efficient
counting with a time complexity

It enhances our understanding of sorting algorithms and their efficiency. Inversions provide a
quantitative measure of an array's disorder in various fields, such as data analysis, ranking
systems.

The project aims to demonstrate practical applications, such as improving sorting algorithms
and analyzing data patterns and understanding array manipulations and algorithm efficiency.

5
2: SYSTEM REQUIREMENT AND METHOD

This code prompts the user to enter the number of elements and the array elements, then counts
and displays the number of inversions along with the inversion pairs

Essential software tools include an Integrated Development Environment (IDE) like Visual
Studio Code, a compiler such as GCC, version control systems like Git, text editors like
Sublime Text, documentation tools like Markdown editors, and debugging tools such as GDB.
These tools streamline coding, testing, and documentation processes.

6
3: IMPLEMENTATION / EXECUTION

On executing the code in compiler we will get the output as,

The methodology involves using a modified Merge Sort algorithm to efficiently count
inversions. The process includes dividing the array, sorting each half, and merging them while
counting the number of inversions. The algorithm is implemented in C, tested with various
input cases, and validated for correctness and efficiency.

To code the algorithm for counting inversions, We started by understanding the problem and
choosing an efficient approach using a modified Merge Sort. Then we implemented the Merge
Sort with modifications to count inversions during the merge step. We included code for user
input and displaying results. Finally, We tested and validated the code with various cases to
ensure correctness and efficiency.

Also,Edge cases of this programme include an empty array, a single element array, already
sorted arrays, reverse sorted arrays, arrays with all identical elements, large arrays, and arrays
with negative numbers. Testing these ensures the algorithm is robust and efficient.

7
4: RESULT AND DISCUSSION

From the project we have achieved a deep understanding of efficient inversion counting using
a modified Merge Sort algorithm, improved C programming skills, enhanced problem-solving
abilities, and gained practical insights into the significance of inversions in various fields. And
now we have gained a good experience to manage and document a technical project effectively.

Dealing with edge cases like empty or single-element arrays was a challenge we faced during
building a programme,But we resolved it by discussing and thinking it as of now we are the
compiler.

To ensure the project is logically and grammatically correct, we used testing and debugging
tools to enhance its effectiveness.

Also maintaining readability and simplicity in the code while implementing a complex
algorithm was also one of our most challenging part. To have this in our code we visited up
some of online websites to see and get help from them.

8
5 :CONCLUSION

Through the "Inversion of Arrays" project, we learned how to implement an efficient algorithm
to count and display inversions using a modified Merge Sort. This enhanced our problem-
solving skills, C programming proficiency, and understanding of algorithm efficiency. The
project highlighted the practical significance of inversion counting in various fields, such as
data analysis and bioinformatics.

The project's impact lies in demonstrating the importance of handling edge cases, ensuring
algorithm correctness, and the ability to manage complex coding challenges effectively.
Overall, it contributed to a deeper comprehension of array manipulations and algorithmic
techniques.

For future improvements, consider optimizing the algorithm for larger datasets, developing a
user-friendly interface, adding features for dynamic or real-time data, and implementing
visualizations. Comprehensive testing, enhanced documentation, and educational materials can
also extend the project's functionality and usability.

9
6: REFERENCES

• Mehlhorn, K., & Sanders, P. (2008). Algorithms and Data Structures: The Basic
Toolbox. Springer
• Brian W Kernighan, Dennis M Ritchie
• Array design by inverse method

10
7: APPENDICES

11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy