ఇచ్చిన 'n' అంశాల జాబితాను క్రమబద్ధీకరించడానికి బబుల్ సార్ట్ అల్గారిథమ్కి ఎన్ని పాసులు అవసరం?

This question was previously asked in
ESE Electronics 2011 Paper 2: Official Paper
View all UPSC IES Papers >
  1. n2
  2. √n
  3. n + 1
  4. n - 1

Answer (Detailed Solution Below)

Option 4 : n - 1
Free
ST 1: UPSC ESE (IES) Civil - Building Materials
6.1 K Users
20 Questions 40 Marks 24 Mins

Detailed Solution

Download Solution PDF

భావన:

బబుల్ సార్ట్:

ప్రక్కనే ఉన్న మూలకాలు తప్పు క్రమంలో ఉన్నట్లయితే వాటిని పదే పదే మార్చుకోవడం ద్వారా పనిచేసే సరళమైన సార్టింగ్ అల్గారిథం ఇది.

పొరుగున ఉన్నవాటిని సరిపోల్చండి, ఎక్కువ ఉంటే, ఇచ్చిపుచ్చుకోండి.

ఉదా. ఇన్‌పుట్ అనేది 70, 20, 35, 90, 15, 11, 24 గా ఉండవనివ్వండి

మూలకాల సంఖ్య (n) = 7

పాస్ – 1: 20, 35, 70, 15, 11, 24, } 90 → 6 పోలిక

పాస్ – 2: 20, 35, 15, 11, 24, } 70, 90 → 5 పోలిక

పాస్ – 3: 20, 15, 11, 24, } 35, 70, 90 → 4 పోలిక

పాస్ – 4: 15, 11, 20, } 24, 35, 70, 90 → 3 పోలిక

పాస్ – 5: 11, 15, } 20, 24, 35, 70, 90 → 2 పోలిక

పాస్ - 6: 11, 15, 20, 24, 35, 70, 90 → 1 పోలిక

పాస్‌ల సంఖ్య = 6

గమనిక: n మూలకం గల బబుల్ సార్ట్ కు n - 1 పాస్‌లు అవసరం.

మొత్తం పోలికలు: \(\frac{{\left( {n - 1} \right)n}}{2}\)

Latest UPSC IES Updates

Last updated on May 28, 2025

->  UPSC ESE admit card 2025 for the prelims exam has been released. 

-> The UPSC IES Prelims 2025 will be held on 8th June 2025.

-> The selection process includes a Prelims and a Mains Examination, followed by a Personality Test/Interview.

-> Candidates should attempt the UPSC IES mock tests to increase their efficiency. The UPSC IES previous year papers can be downloaded here.

More Sorting Questions

Get Free Access Now
Hot Links: teen patti joy official teen patti vungo teen patti rich teen patti master purana teen patti master