Join WhatsApp Group Join Now!

DSU 313301 Practical No.11: Write a ‘C’ Program to Sort an Array of Strings using Insertion Sort Method

DSU 313301 Practical No.11: Write a ‘C’ Program to Sort an Array of Strings using Insertion Sort Method
Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated

 DSU 313301 Practical No.11:  Write a ‘C’ Program to Sort an Array of Strings using the Insertion Sort Method

Insertion sort is a simple sorting algorithm that works by iteratively inserting each element of an unsorted list into its correct position in a sorted portion of the list. It is a stable sorting algorithm, meaning that elements with equal values maintain relative order in the sorted output.

DSU 313301 Practical

C Program Code

Algorithm


Flow Chart

Use the below instructions to draw a flow chart


Output of code

Original array of strings:
banana
apple
orange
mango
pear

Sorted array of strings:
apple
banana
mango
orange
pear

Practical Related Questions

1. Create an interactive game where the user enters a list of strings, and the program sorts them using insertion sort. Allow the user to add or remove strings dynamically and see the sorting process step by step.

Answer:


2. Implement insertion sort with a custom comparison function that sorts strings based on a specific criterion (e.g., number of vowels, number of consonants, etc.).

Answer:


Exercise

1. Write when it is suitable to use Insertion Sort

Answer:



2. List Applications of Insertion Sort

Answer:


3. Explain how insertion sort handles strings with different lengths?

Answer:

It works by building a sorted array one element at a time, picking each element from the unsorted section, and inserting it into its correct position in the sorted part.

Conclusion

We successfully completed DSU 313301 Practical No.11 and Wrote a ‘C’ Program to Sort an Array of Strings using the Insertion Sort Method.
Hi everyone, I'm Suraj Diware, and I'm passionate about helping students succeed in MSBTE programs. This blog is dedicated to providing clear and concise explanations of MSBTE curriculum topics, along with practical tips and resources to sup…

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.