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?

  • $\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
  • 1
    $\begingroup$ Related questions: 1, 2. $\endgroup$ – Raphael Jan 26 '17 at 21:09

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.


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.


"...the most common misconception that an algorithm and a pseudocode is one of the same things. No, they are not! Let us take a look at definitions first:

Algorithm : Systematic logical approach which is a well-defined, step-by-step procedure that allows a computer to solve a problem. (Can be what's in the code-side Notes explaining the performance steps of a function, in the case of good Notes.)

Pseudocode : It is a simpler version of a programming code in plain English which uses short phrases to write code for a program before it is implemented in a specific programming language.

Program : It is exact code written for problem following all the rules of the programming language." (https://www.geeksforgeeks.org/difference-between-algorithm-pseudocode-and-program/?ref=lbp)

Your professor highlighted the endeavor of algorithm to correctly and fully assess a # of applicable and inapplicable inputs and thus arrive at an accurate and full solution to the specifically suggested solvable problem. Your program [sufficient language usage] derives from its algorithm [procedural logic of arrangement thereof] to provide an adequate and honest answer to the question of underlying browser resolution. Emphasis on logic of methodology may be taken for granted in programs... you had to eliminate dependencies to attain accurate information regarding any given browser, regardless of values set among different properties offered within features of the browser.

Your pseudocode transforms the task-list of your algorithm-based procedure (logical multi-steps, exhaustive/conclusive operations, "only-every" aspect and behavior that must factor into the solution posited by a program to offer true solution) into more codiFIED instructions, as are better understood by the eventual machine code understanding of a running computer. However, "pseudocode is not an actual programming language... Many time algorithms are presented using pseudocode since they can be read and understood by programmers who are familiar with different programming languages. Pseudocode allows you to include several control structures such as While, If-then-else, Repeat-until, for and case, which is present in many high-level languages..." Pseudocode remains a high-level understood meld of syntax and symbols to structurally signify the roles of programming articulation in the final draft... If the program wasn't accurate in some browser cases, and not for the code of the program throwing errors or negating designed tasks, were some browser aspects not considered within the design itself of your algorithm (i.e. approach to solution?)

  • 1
    $\begingroup$ Do you have a source for "pseudocode is not an actual programming language"? I agree with the statement, but a source would improve your argument. $\endgroup$ – LabGecko Oct 5 '20 at 21:33

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.