3
$\begingroup$

For my undergraduate senior project, a professor asked me and my partner to design an algorithm to determine true resolution in the browser, unaffected by zooming, multiple screens, viewport size, etc. (tl;dr our implementation was okay, it usually did the job correctly.)

It's super pedantic, but I've been thinking about the terminology of calling it an "algorithm". It really doesn't seem like an algorithm, because it's very dependent on JavaScript and the state of the browser at a given time. Particularly, our script has a lot of if-statements to determine what what variables and data to work with depending on the browser and configuration. I certainly don't think I could write it out in a language-agnostic pseudocode.

Is there a better word to describe what we wrote? Does it count as an "algorithm" per say? If I had to think of alternate words, they'd be:

  • implementation (but of what, just our general idea/design?)
  • script/program

Are there better words that are more general than simply script or program?

$\endgroup$
  • $\begingroup$ Perhaps a "library"? "subroutine"? "module" (if it applies)? "Algorithm" sounds wrong for this, "program" is already much better in my opinion. $\endgroup$ – chi Jan 26 '17 at 14:27
  • $\begingroup$ Ask your professor which term they prefer. Whether something is an algorithm or not is mostly a matter of taste. $\endgroup$ – adrianN Jan 26 '17 at 16:43
  • $\begingroup$ Are you paying money for that course? That sounds like a poor excuse for a computer science project... :/ $\endgroup$ – Raphael Jan 26 '17 at 21:08
  • $\begingroup$ Related questions: 1, 2. $\endgroup$ – Raphael Jan 26 '17 at 21:09
5
$\begingroup$

You can certainly describe the inner workings of your project as an algorithm. It takes an input (whatever information it obtains from the browser) and produces an output, as a result of some scheme of calculations. Perhaps it needs to read inputs during the course of its calculations (depending on the first inputs, it might make different queries of the browser), so it might be some sort of interactive or adaptive algorithm.

| cite | improve this answer | |
$\endgroup$
2
$\begingroup$

In my opinion anything that is language specific would not be considered an algorithm but a solution. So in your case you came up with a javascript solution to solve your problem. I think you answered your own question when you said you could not write the pseudocode. If your solution can not be written in psuedocode then i would not classify it as an algorithm.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.