0% found this document useful (0 votes)
13 views16 pages

3.3.3 Merge Sort

The document outlines the vision and mission of the University Institute of Computing's Bachelor of Computer Application program, emphasizing innovative learning and industry collaboration. It details program outcomes, educational objectives, and specific outcomes related to data structures, particularly focusing on the Merge Sort algorithm. Additionally, it includes complexity analysis, book references, and a video link for further learning.

Uploaded by

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

3.3.3 Merge Sort

The document outlines the vision and mission of the University Institute of Computing's Bachelor of Computer Application program, emphasizing innovative learning and industry collaboration. It details program outcomes, educational objectives, and specific outcomes related to data structures, particularly focusing on the Merge Sort algorithm. Additionally, it includes complexity analysis, book references, and a video link for further learning.

Uploaded by

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

UNIVERSITY INSTITUTE OF COMPUTING

Bachelor of Computer Application


Subject Name: Data Structure
23CAT-201/ 23SCT-201
VISION

To be a Centre of Excellence for nurturing computer professionals with


strong application expertise through experiential learning and research
for matching the requirements of industry and society instilling in them
the spirit of innovation and entrepreneurship.

2
Mission of the Department

M1. To provide innovative learning centric facilities and quality-


oriented teaching learning process for solving computational problems.
M2. To provide a frame work through Project Based Learning to
support society and industry in promoting a multidisciplinary activity.
M3. To develop crystal clear evaluation system and experiential
learning mechanism aligned with futuristic technologies and industry.
M4. To provide doorway for promoting research, innovation and
entrepreneurship skills incollaboration with industry and academia.
M5. To undertake societal activities for upliftment of rural/deprived
sections of the society.
3
Program Outcomes
• PO1 Apply mathematics and computing fundamental and domain concepts to find out the solution of defined problems and requirements. (Computational
Knowledge)
• PO2 Use fundamental principle of Mathematics and Computing to identify, formulate research literature for solving complex problems, reaching appropriate
solutions. (Problem Analysis)
• PO3 Understand to design, analyze and develop solutions and evaluate system components or processes to meet specific need for local, regional and global public
health, societal, cultural, and environmental systems.
• PO4 (Design /Development of Solutions)Use expertise research-based knowledge and methods including skills for analysis and development of information to
reach valid conclusions. (Conduct Investigations of Complex Computing Problems)
• PO5 Adapt, apply appropriate modern computing tools and techniques to solve computing activities keeping in view the limitations. (Modern Tool Usage)
• PO6 Exhibiting ethics for regulations, responsibilities and norms in professional computing practices. (Professional Ethics)
• PO7 Enlighten knowledge to enhance understanding and building research, strategies in independent learning for continual development as computer applications
professional. (Life-long Learning)
• PO8 Establishing strategies in developing and implementing ideas in multi- disciplinary environments using computing and management skills as a member or
leader in a team. (Project Management and Finance)
• PO9 Contribute to progressive community and society in comprehending computing activities by writing effective reports, designing documentation, making
effective presentation, and understand instructions. (Communication Efficacy)
• PO10 Apply mathematics and computing knowledge to access and solve issues relating to health, safety, societal, environmental, legal, and cultural issues within
local, regional and global context. (Societal and Environmental Concern)
• PO11 Gain confidence for self and continuous learning to improve knowledge and competence as a member or leader of a team. (Individual and Teamwork)
• PO12 Learn to innovate, design and develop solutions for solving real life business problems and addressing business development issues with a passion for quality
competency and holistic approach. (Innovation and Entrepreneurship)

4
Program Educational Objectives

PEO1 Demonstrate analytical and design skills including the ability to generate creative solutions and foster
team-oriented professionalism through effective communication in their careers.
PEO2 Expertise in successful careers based on their understanding of formal and practical methods of
application development using the concept of computer programming languages and design principles in
accordance to industry 4.0
PEO3 Exhibit the growth of the nation and society by implementing and acquiring knowledge of upliftment of
health, safety and other societal issues.
PEO4 Implement their exhibiting critical thinking and problem- solving skills in professional practices or tackle
social, technical and business challenges.

5
Program Specific Outcomes

PSO1 Analyze their abilities in systematic planning, developing, testing


and executing complex computing applications in field of Social-Media
and Analytics, Web Application Development and Data Interpretations.
PSO2 Apprise in-depth expertise and sustainable learning that
contributes to multi-disciplinary creativity, permutation, modernization
and study to address global interest.

6
Topic To be Covered

• Merge sort (CO5)


Merge Sort Algorithm

• Merge Sort is one of the most popular sorting algorithms that is based
on the principle of Divide and Conquer Algorithm.
• A problem is divided into multiple sub-problems. Each sub-problem is
solved individually. Finally, sub-problems are combined to form the
final solution.
Merge Sort Algorithm
mergesort(array,beg,end)

1. Start
2. declare array and left, right, mid variable
3. perform merge function.
mergesort(array,left,right)
mergesort (array, left, right)
if left > right
return
mid= (left+right)/2
mergesort(array, left, mid)
mergesort(array, mid+1, right)
merge(array, left, mid, right)
4. Stop
Program of Merge Sort
#include<iostream> while(i<nl) { //extra element in left array
using namespace std; array[k] = larr[i];
void swapping(int &a, int &b) { //swap the content of a and b i++; k++;
int temp; }
temp = a; while(j<nr) { //extra element in right array
a = b;
array[k] = rarr[j];
b = temp;
j++; k++;
}
void display(int *array, int size) { }
for (int i = 0; i<size; i++) }void mergeSort(int *array, int l, int r) {
cout << array[i] << " "; int m;
cout << endl; if (l < r) {
} int m = l+(r-l)/2; // Sort first and second arrays
void merge(int *array, int l, int m, int r) { mergeSort(array, l, m);
int i, j, k, nl, nr; //size of left and right sub-arrays mergeSort(array, m+1, r);
nl = m-l+1; nr = r-m; merge(array, l, m, r);
int larr[nl], rarr[nr]; //fill left and right sub-arrays }
for(i = 0; i<nl; i++) }
larr[i] = array[l+i]; int main() {
for(j = 0; j<nr; j++)
int n;
rarr[j] = array[m+1+j];
cout << "Enter the number of elements: ";
i = 0; j = 0; k = l; //marge temp arrays to real array
while(i < nl && j<nr) { cin >> n;
if(larr[i] <= rarr[j]) { int arr[n]; //create an array with given number of elements
array[k] = larr[i]; cout << "Enter elements:" << endl;
i++; for(int i = 0; i<n; i++) {
} cin >> arr[i];
else{ }
array[k] = rarr[j]; cout << "Array before Sorting: ";
j++; display(arr, n);
} mergeSort(arr, 0, n-1); //(n-1) for last index
k++; cout << "Array after Sorting: ";
} display(arr, n);
}
Complexity of merge sort

• Time Complexity: O(n*logn)


• Space Complexity: O(n)
In merge sort all elements are copied into an auxiliary array. So N
auxiliary space is required for merge sort.
Book References
TEXT BOOKS
• Seymour Lipchitz, Schaum's Outlines Series Data Structures TMH. J.P. Hayes,
Computer Organization and Architecture, Third Edition, TMH.
• Data Structure Theory Problem and Algorithms, R.S. Salaria, Khanna Book
Publishing Company, Delhi.
REFERENCE BOOKS
• Introduction to Data Structures Applications, Trembley&Soreson, Second
Edition, Pearson Education Robert L. Britton, MIPS Assembly Language
Programming, Pearson Prentice Hall.
• A. Tanenbaum, Y. Lanhgsam and A. J. Augenstein, Data Structures Using C++,
Prentice Hall of India, 1990
Video Links

https://www.youtube.com/watch?v=jlHkDBEumP0
THANK YOU

Created by: Deepika Dhiman (E15896)


[email protected]

You might also like