Top answers


Find a given element m in a list of n sorted numbers, with time complexity O(log(n))

An implementation of the Binary Search algorithm will be sufficient. The algorithm works as follows:Position on the middle element in the list of numbers. If the current number is equal to the given number t...
VH
Answered by Vlad H. Computing tutor
1339 Views

Convert 10101101 from binary to both decimal and hexadecimal

Decimal : 173 Hexadecimal : AD
EB
Answered by Emma B. Computing tutor
3351 Views

A common construct found in many algorithms is a loop. Using pseudocode, write a pre-condition loop to output all of the even numbers between 99 and 201.

Key points when answering questions are the marks given for it and how the question is defined. In this example we need to write a pre-condition loop to output all the even numbers in the range (99,201) , an...
SA
3467 Views

Convert 'A1' hexadecimal value into binary.

Firstly split the number into 2 since there are two numbers. A and 1. We first convert 'A' into decimal. The corresponding value is 10. We then convert 10 into binary which is 1010. That is the first part of...
JL
Answered by Jazir L. Computing tutor
8903 Views

Write a function in pseudocode that determines if a given string is a palindrome

Declare and Initiate a new empty stringTraverse the given string using a loopTake each char from the given string and concatenate it to the beginning of the new stringCompare the final new string with the gi...
CV
Answered by Charles V. Computing tutor
2285 Views