Optimized bubble sort c#

Optimized version of bubble sort Bubble sort is a slow comparison based sorting algorithm. Can you suggest one way to optimize it. Optimized bubble sort complexity and solution Bubble sort works by repeatedly visiting all elements of the list to be sorted comparing each pair of adjacent elements and swapping them if they are not

Integer division c++

Integer division problem definition Given the following function which computes integer division. Debug the code and identify the major bugs. Modify the code to fix those bugs. Assume all integer variables are within range and no overflow is about to happen. int Division(int numerator, int denominator) { int quotient = 0; while (numerator > denominator)

Sum of Integers in a Range

Problem Write a function to compute the sum of integers between two given integer values. Solution The naive solution is to loop by going from the lower integer ending at the higher integer while calculating the sum. The other solution is compute the sum using the following formula Sum (1..n) = n (n + 1)/2

SQL All Keyword

All Keyword in SQL Given the following database table: employee(emp_name, emp_salary) write an SQL statement to print the employee name with the highest salary Solution Using the max aggregate function will give us the maximum salary but it does not give us the name of the employee who has the maximum salary. The solution is

SQL Having Clause

Problem You have the following database table: employee (emp_name, emp_age, emp_department) Write an SQL statement to calculate the average age of employees who are older than 30 years old for each department. Do not display the average if the number of employees used in the calculation is less than 3. Solution You need to use