Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Smaller Scores
A group of people(P) are playing an online game. Their scores are stored in the order of their entry time in S. Each integer S[i] corresponds to the score of the person Pi.
For each person 
Pi you have to report the number of people who played after the person and scored less than the person.
Input
The first line contains a single integer 
N. The second line contains N space-separated integers representing the score S[i] of person Pi.
Output
The output should contain 
N space-separated integers representing the number of people who played after the person and scored less than the person.
Explanation
Given 
S = 13 12 11
Score of P1 is 13. Score of P2 is 12. Score of P3 is 11.
The number of people who played after P1 and scored less than 13 is 2(12, 11). The number of people who played after P2 and scored less than 12 is 1(11). The number of people who played after P3 and scored less than 11 is 0.
The output is 
2 1 0.
Sample Input 1
3
13 12 11
Sample Output 1
2 1 0
Sample Input 2
4
4 3 5 2
Sample Output 2
2 1 1 0

1. With aid of a diagram, explain the stages the CPU goes through as it executes a 

program. [25 marks] 

2. Give a brief account on the technology used in Flash memory implementation [25

marks] 

3. Explain the start-up process of a computer clearly indicating the purpose of the POST, 

BIOS and CMOS. [25 marks].

4. With aid of a diagram, give a brief explanation on the type of busses available on 

modern computer systems and the purpose of the North Bridge and South Bridge. 

Your diagram should clearly show where the bridges are and what connects them. [25



Akshita loves chocolates, numbers and algorithms. Her friends Ina and Mina gave her a and b chocolates respectively.  Given her love for numbers, she likes all the numbers that are divisible by either ‘a’ or ‘b’ or both. She wants to find the nth smallest such number that is divisible by either a or b. Suggest her an algorithm to find the desired number, describe the principle on which the algorithm is based, write the pseudocode and the recurrence relation for the same. Also state which subproblem will give the answer to the original problem.

Expected Complexity → O(log(N∗min(A,B))).  

Assume a and b to be co-prime positive integers.




12. Write a Java program to print the sum of two numbers.



13. Write a Java program that simulates a guessing number game. The program will generate a random value the user needs to guess and keep asking the user for a guess until the user provides the expected value. If a value has already provided, the program will print the message “Value already provided”. If the value is higher than the value to guess, the program will print“Too high”; if it is less, the program will print the message “Too low”. Once the user enters the expected value, the program will print the number of attempts.






12. Show the Java code to declare and allocate an array with 497 elements of type double.





13. Print i as long as i is less than 6.



11.Evaluate the following Java expressions, assuming x and y are both declared as integer variables and x = 17and y = 6:


x/y+3     =                                         

x%y*4     =                                         

x-y/3     =                                       


What are the actual parameter in c++ ?

Mickeymouse loves numbers in the range [m1, m2] (m1 and m2 included). Minnie decides to gift Mickey an array of numbers for his birthday. Mickey wants to find the number of pairs of indices [l, r] for which the sum of all the  elements in the range [l, r] lies between m1 and m2.   


  1. Come up with an algorithm with a worst case complexity of O(N2).   (5 marks) 
  2. Now improvise this algorithm, assuming all numbers are positive integers.    (7 marks)
  3. What if the numbers could be negative as well? Can you think of an O(nlogn) solution in this case? (Hint: use sorting)  (10 marks)


Sample case: 

Array = [-2, 5, -1]

M1 = -2

M2 = 2

Output: 3 

[[0, 0], [2, 2], [0, 2]] are the three pairs of [l, r] that satisfy the condition. So, that is why, the output is 3.




Akshita loves chocolates, numbers and algorithms. Her friends Ina and Mina gave her a and b chocolates respectively.  Given her love for numbers, she likes all the numbers that are divisible by either ‘a’ or ‘b’ or both. She wants to find the nth smallest such number that is divisible by either a or b. Suggest her an algorithm to find the desired number, describe the principle on which the algorithm is based, write the pseudocode and the recurrence relation for the same. Also state which subproblem will give the answer to the original problem.


Expected Complexity → O(log(N∗min(A,B))).  


Assume a and b to be co-prime positive integers.




LATEST TUTORIALS
APPROVED BY CLIENTS