Highlights
1. Write a program that prompts the user to enter a decimal number and displays the number in a fraction. Fraction should be in the smallest form without any common factor between numerator and denominator.
2. 1st Jan 2023 is a Sunday. Enter any year and determine what day is the 1st of Jan of that year.
3. Given an array of n integers, find all unique triplets in the array that sum up to a given target value. The solution should return a list of lists, where each list contains three unique integers that sum up to the target value. The output lists should be sorted in ascending order. For example, given the array [-1, 0, 1, 2, -1, -4] and target value 0, the solution should return [[ -1, 0, 1 ], [ -1, -1, 2 ]]
4. A secret integer t is selected at random within the range 1 ≤ t ≤ n. The goal is to guess the value of t by making repeated guesses, via integer g. After a guess is made, there are three possible outcomes, in which it will be revealed that either g < t xss=removed> t. Then the process can repeat as necessary. Normally, the number of guesses required on average can be minimized with a binary search: Given a lower bound L and upper bound H (initialized to L = 1 and H = n), let g = ⌊(L+H)/2⌋ where ⌊⋅⌋ is the integer floor function. If g = t, the process ends. Otherwise, if g < t xss=removed> t instead, set H = g−1. After setting the new bounds, the search process repeats, and ultimately ends once t is found. Even if t can be deduced without searching, assume that a search will be required anyway to confirm the value.
Your friend Bob believes that the standard binary search is not that much better than his randomized variant: Instead of setting g = ⌊(L+H)/2⌋, simply let g be a random integer between L and H, inclusive. The rest of the algorithm is the same as the standard binary search. This new search routine will be referred to as a random binary search. Given that 1 ≤ t ≤ n for random t, let B(n) be the expected number of guesses needed to find t using the standard binary search, and let R(n) be the expected number of guesses needed to find t using the random binary search. For example, B(6) = 2.33333333 and R(6) = 2.71666667 when rounded to 8 decimal places. Find R(10^10) − B(10^10) rounded to 8 decimal places.
5. Create a dictionary with keys ‘Even’, ‘Odd’, ‘Prime’, ‘Palindrome’. Corresponding values of those keys should be counts of Even, Odd, Prime and Palindrome numbers from 1 to 1000 inclusive.
6. Create a class of Triangle, with private variables for its sides. Also, create a method which will determine if the triangle is valid or not. If the triangle is valid, also determine the type of triangle (scalene, equilateral, isosceles).
This B9DA108 - IT Computer Science has been solved by our PhD Experts at My Uni Paper.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.