मराठी

In the following list containing integers, sort the list using Insertion sort algorithm. Also show the status of the list after each iteration. 15 -5 20 -10 10

Advertisements
Advertisements

प्रश्न

In the following list containing integers, sort the list using Insertion sort algorithm. Also show the status of the list after each iteration.

15     -5     20      -10     10

लघु उत्तर
Advertisements

उत्तर

Initial list: [15, -5, 20, -10, 10]

Iteration Element inserted Status of list
1 -5 [-5, 15, 20, -10, 10]
2 20 [-5, 15, 20, -10, 10]
3 -10 [-10, -5, 15, 20, 10]
4 10 [-10, -5, 10, 15, 20]

Sorted list: [-10, -5, 10, 15, 20]

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 5: Liner List Manipulation - EXERCISE [पृष्ठ १०४]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
पाठ 5 Liner List Manipulation
EXERCISE | Q 11. | पृष्ठ १०४
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×