Home / MCQ Bank / Computer
Computer Sorting Algorithms Difficulty: Medium

Odd-even sort is a variation of . . . . . . . .

Select the correct option to test your answer:

More Computer Questions

What happens when a reference is declared but not initialized in C++? To which of the following object does the print() method belong to? What does the each_slice method do in Ruby enumerators? Determine output: public class Test{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.val = 1; obj.call(obj); System.out.println(obj.val); } } class MyClass{ public int val; public void call(MyClass ref){ ref.val++; } } What will be the value stored in max_value when the following code is executed? #include<stdio.h> #include<limits.h> int max_of_two(int a, int b) { if(a > b) return a; return b; } int rod_cut(int *prices, int len) { int max_price = INT_MIN; // INT_MIN is the min value an integer can take int i; if(len <= 0 ) return 0; for(i = 0; i < len; i++) // subtract 1 because index starts from 0 max_price = max_of_two(prices[i] + rod_cut(prices,len - i - 1), max_price); return max_price; } int main() { int prices[]={2, 5, 6, 9, 9, 17, 17, 18, 20, 22},len_of_rod = 3; int ans = rod_cut(prices, len_of_rod); printf("%d",ans); return 0; }