Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.2k views
in Computer by (48.9k points)
closed by

The following function is a part of some class which computes and sorts an array arr [] is ascending order using the bubble sort technique. There are some places in the code marked by ?1?, ?2?, ?3?, ?4?, ?5? which must be replaced by a statement/expression so that the function works properly:

void bubblesort (int arr []) 

{ int i. j, k temp; 

for (i = 0; ?1?; i ++) 

for (j = 0; ?2?;j++) 

arr[j] > ?3?) 

temp = arr [j]; 

?4? = arr [j + 1]; 

arr [j + 1] = ?5?; 

}

(i) What is the expression or statement at ?1? 

(ii) What is the expression or statement at ?2? 

(iii) What is the expression or statement at ?3? 

(iv) What is the expression or statement at ?4?

(v) What is the expression or statement at ?5?

1 Answer

+1 vote
by (49.8k points)
selected by
 
Best answer

(i) i < arr.length 

(ii) j < arr.length – 1 – i 

(iii) arr [j + 1] 

(iv) arr [j] 

(v) temp

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...