printfNum
BAN USER- 0of 0 votes
AnswersHow long it will take to download a file containing all words of English dictionary on to the RAM
- printfNum in United States| Report Duplicate | Flag | PURGE
Jr. Software Engineer - 0of 0 votes
AnswersImplement the function accumulate below in the language of your choice. The code is in PHP but the syntax of this question should translate into any language. You should have enough information from the comments to define this function correctly. You do not need to implement the function calc.
/**
* This interface should be implemented to represent doing a binary operation on two integers
*/interface iBinaryOperator { /** * This will take int $x and int $y and return an integer value or throw an exception * * @param int $x * @param int $y * @return int the value of the binary operation of $x and $y * @throws MathException */ public function calc($x, $y); } /** * This function should go through the array of operands and run calc on each operand IN ORDER, then * return the accumulated value. * * For example the code below would echo the value 10: * * $op = new Addition(); //class Addition obviously implements iBinaryOperator * $operands = array(5,2,3); * echo accumulate($op, $operands); * * This function should work for ANY size array of operands, and ANY class that implements iBinaryOperator * * @param iBinaryOperator $op * @param array $operands array of integers of size N, can be empty * @return int|string returns an int on successful accumulation, or the string 'error' in error conditions */ function accumulate(iBinaryOperator $op, array $operands) {//Add code here in the language of your choice
}
- printfNum in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer PHP - 0of 0 votes
AnswersThere is a function that scans an array of characters for the character 'e' and prints out each index. What is the complexity? Please implement this function in C, C++, PHP or JavaScript.
- printfNum in United States
If I sort the array, what is the complexity of the sort? What type of sort?
After sorting, what is the complexity if I rescan the array for the character 'e'?| Report Duplicate | Flag | PURGE
Software Engineer / Developer PHP