The document discusses various sorting algorithms including bubble sort and insertion sort. Bubble sort compares adjacent elements and swaps them if they are out of order, making multiple passes through the list. Insertion sort inserts elements into the sorted portion of the list one by one. Both algorithms have quadratic time complexity in the worst case but insertion sort performs better on partially sorted lists.
Sorting in data structures is a fundamental operation that is crucial for optimizing the efficiency of data retrieval and manipulation. By ordering data elements according to a defined sequence (numerical, lexicographical, etc.), sorting makes it possible to search for elements more quickly than would be possible in an unsorted structure, especially with algorithms like binary search that rely on a sorted array to operate effectively.
In addition, sorting is essential for tasks that require an ordered dataset, such as finding median values, generating frequency counts, or performing range queries. It also lays the groundwork for more complex operations, such as merging datasets, which requires sorted data to be carried out efficiently.
Sorting in data structures is a fundamental operation that is crucial for optimizing the efficiency of data retrieval and manipulation. By ordering data elements according to a defined sequence (numerical, lexicographical, etc.), sorting makes it possible to search for elements more quickly than would be possible in an unsorted structure, especially with algorithms like binary search that rely on a sorted array to operate effectively.
In addition, sorting is essential for tasks that require an ordered dataset, such as finding median values, generating frequency counts, or performing range queries. It also lays the groundwork for more complex operations, such as merging datasets, which requires sorted data to be carried out efficiently.
This slide explains three (3) basic sorting algorithms with codes on github. Bubble sort, Selection sort and insertion sort.
visit https://github.com/EngrMikolo/BasicSortingAlgorithms to checkout the codes
In this article, different types of sorting algorithms like the bubble sort, selection sort, etc are discussed. The working method, implementation using C language, and time complexity of different algorithms are also discussed.
This slide explains three (3) basic sorting algorithms with codes on github. Bubble sort, Selection sort and insertion sort.
visit https://github.com/EngrMikolo/BasicSortingAlgorithms to checkout the codes
In this article, different types of sorting algorithms like the bubble sort, selection sort, etc are discussed. The working method, implementation using C language, and time complexity of different algorithms are also discussed.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
1. Agenda
• Sorting
• Definition & terminology
• Bubble sort
• Algorithm of bubble sort
• Function to implement bubble sort
• Advantages & disadvantages of bubble sort
• Efficiency of bubble sort
• Insertion sort
2. Sorting
• It is the process of arranging elements in
ascending or descending order of the key
values.
• Sorting techniques:
1. Bubble sort
2. Insertion sort
3. Selection sort
4. Quick sort
5. Merge sort
3. Bubble sort
• Bubble sort is a simple sorting algorithm. This
sorting algorithm is comparison-based
algorithm in which each pair of adjacent
elements is compared and the elements are
swapped if they are not in order.
• This algorithm is not suitable for large data
sets as its average and worst case complexity
are of Ο(n2) where n is the number of items.
6. Algorithm for bubble sort
1. Start
2. Pass=1
3. i=0
4. if x[i]>x[i+1]
5. i=i+1
6. If i<=n-1-pass
goto step 4
7. Pass = Pass+1
8. if Pass < n
goto step 3
9. Stop.
7. Function to implement bubble sort
// A function to implement bubble sort
void bubbleSort (int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
8. Function to print an array
• /* Function to print an array */
• void printArray(int arr[], int size)
• {
• int i;
• for (i=0; i < size; i++)
• printf("%d ", arr[i]);
• printf("n");
• }
9. Advantages of bubble sort
• It is simple sorting method.
• No addition data structure is required.
• It is in-place sorting method.
• It is stable sorting method.
10. Disadvantages of bubble sort
• It is very inefficiency method. O(n2)
• Even of the element are in sorted order,
a[n-1] pass will be done.
12. Insertion sort
• Insertion sort works similarly as we sort cards in a
card game.
• We assume that the first card is already sorted then,
we select an unsorted card. If the unsorted card is
greater than the card in hand, it is placed on the
right otherwise, to the left. In the same way, other
unsorted cards are taken and put at their right place.
• Insertion sort is a sorting algorithm that places an
unsorted element at its suitable place in each
iteration.
13.
14.
15. Algorithm for Insertion sort
1. Start
2. j=1 i.e unsorted position starts from 1
3. Key=x[j]
4. i=j-1 i.e. sorted position starts from1
5. While x[i]>key and i>=0
x[i+1]=key i.e. insert key in correct position
6. j=j+1 next unsorted element
7. If j<n
goto step 3
6. Stop.
17. .
/* Function to sort an array using insertion sort*/
void insertionSort(int arr[], int n)
{
int i, key, j;
for (i = 1; i < n; i++) {
key = arr[i];
j = i - 1;
/* Move elements of arr[0..i-1], that are greater than key, to one position
ahead of their current position */
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
}
}
18. Advantages and disadvantages of Insertion sort
Advantages :
• It is simple sorting method.
• No addition data structure is required.
• It is in-place sorting method.
• It is stable sorting method.
• Best case time complexity is o(n)
• Most suitable sorting method is if the element are already
sorted.
Disadvantages:
• worst case time complexity is O(n2)