Top answers


Write a recursive binary search algorithm in pseudocode.

A binary search algorithm is one of the most important searching algorithm, user on sorted arrays. This algorithm searches for a given number (value) in an array A. How does the algorithm works ?1) check if ...
TU
Answered by Tudor U. Computing tutor
2637 Views

Given two strings s1 and s2 return the location of each permutation of the s1 string within the s2 string.

Solution: Iterate through s2 and select blocks of characters of length equal to that of s1 (for simplicity let's call this block string ref). Now, check if ref is a permutation of s1 . To check this we have ...
VH
Answered by Vlad H. Computing tutor
1619 Views

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
1288 Views

What is polymorphism in regards to Object Oriented Programming (OOP)? Provide an example.

The word ‘polymorphism’ literally means ‘a state of having many shapes’ or ‘the capacity to take on different forms’. When applied to object oriented programming languages like Java, it describes a language’...
PR
Answered by Paras R. Computing tutor
2136 Views

What is inheritance in object-oriented programming?

Inheritance is a useful and powerful concept in object-oriented programming languages, such as Java and C++. Inheritance is used to provide subclasses with the same instance variables and operations as the s...
RF
Answered by Ryan F. Computing tutor
2557 Views