Purchase Solution

Pseudocode to Process Numerical Substrings

Not what you're looking for?

Ask Custom Question

Write an algorithm, using pseudo code, to perform one of the following tasks,* Given a string of numbers, identify all of the substrings that form numbers that are divisible by 3. For example, applying the algorithm on the string 37540 should produce the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 540

Purchase this Solution

Solution Summary

Pseudocode and explanation are provided in this solution.

Solution Preview

My pseudocode will be very BASIC like. You will want to translate it to look more like C or Java I suppose.

This solution will make use of the MOD function. See http://en.wikipedia.org/wiki/Modulo for more info.

If you can't use MOD, you can easily check if a number is divisible by three by recursively summing its digits until you get a single digit number. If that ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Javscript Basics

Quiz on basics of javascript programming language.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.