Questions tagged [pseudocode]

Pseudocode is a compact and informal high-level description of a computer programming algorithm. It represents the code and may look similar to the code or code constructs, but it isn't actual code. It is a representation of the code or code construct. Use this tag for questions which are about pseudocode. Do not use this tag for questions which include pseudocode incidentally.

An easy way of understanding pseudocode is by comparing it to the actual programming language.

For example, you would like to write a code that checks if the student's grade is above the permissible threshold, and if it is then you would like to indicate that the student passed.

This is how it is achieved in Python:

if studentsGrade >= 70:
    print("Student passed")
else
    print("Student failed")

Pseudocode to describe the abovementioned code will be as follows:

if a student's grade is greater than or equal to 70
    Print "Student passed"
else
    Print "Student failed"
1942 questions
0
votes
0 answers

Quick Time Event in Swing [pseudocode request]

I am in the extremely early stages of designing a game (so early that I haven't even committed to it yet). The idea is an RPG with a Quick Time Event for attacking and defending that relies on precise mouse movements or timed button presses to…
chif-ii
  • 995
  • 1
  • 6
  • 12
0
votes
1 answer

Step-by-step method for coming up with recursive algorithms for tree traversals?

I'm trying to understand intuitively how to create recursive functions (for anything) but mostly for traversing a tree to check if that tree meets certain criteria. For a random example, counting the number of nodes in a Binary Tree that are not the…
0
votes
1 answer

Algorithm Analysis: Big Oh Complexity, express output as a function

What is the value returned by the following function? Express your answer as a function of n. Give using O() notation the worst-case running time. Pseudo code of the algorithm: F1(n) v = 0 for i = 1 to n for j = n + 1 to 2n …
0
votes
4 answers

How to add up all numbers up to, and including, the input number?

I'm a total JS noobie, and I'm trying to make it so that after one input is entered all of the numbers between 0 and that input are added up, including the input. Here is the basic pseudo code I'm trying to accomplish but i can't figure it out? get…
0
votes
4 answers

What does ":=" refer to?

I'm looking at the algorithm for breadth-first sorting of a binary search tree, and there is a symbol used that I cannot understand. Funny enough, Google returns zero results. // levelorder() // q = empty queue // q.enqueue(root) // …
Mock
  • 359
  • 1
  • 3
  • 11
0
votes
4 answers

Need XOR Encryption Algorithm Pseudocode

I am trying to find the pseudocode for the XOR encryption algorithm. However I've had no luck so far. Anybody know where I can find it? EDIT: XOR 32 if that helps EDIT 2: For Passwords
ritch
  • 1,760
  • 14
  • 37
  • 65
0
votes
0 answers

Generating points in space according to a 3D probability grid

If I have a bunch of point called point_set_A (enclosed by a cube for example), each with a normalized probability value (the values are based on something, e.g. flow velocity). How do I populate that same space (cube) with (say 100) point_set_B (so…
Tim
  • 135
  • 1
  • 11
0
votes
0 answers

How do I receive user input for a dungeon crawler?

So, I am planning on designing a dungeon crawler (like Nethack), and I was wondering how I could get the user's input for moving the player. I originally planned to get a character input (W,S,A, or D) and then when the user presses enter, the…
LightMikeE
  • 719
  • 3
  • 8
  • 17
0
votes
2 answers

Code to run a large countdown timer

I want to write a program to run a countdown timer with initial start value of, say, 7 years. The computer can reboot in between. I can think of file based approach: open file if file_empty write initval = 7 years while cpu_on write…
manav m-n
  • 11,136
  • 23
  • 74
  • 97
0
votes
3 answers

Creating a Pseudo Code and Diagram from C# Program

I have developed an application which is used to parse user utterances for the extraction of relevant information stored in the database. The developed application has been purely developed using C# and consists of few functions, procedures etc. I…
kashif4u
  • 175
  • 1
  • 3
  • 13
0
votes
0 answers

pseudocode about registers and clients

I have projects that requires to simulate a market with 3 registers. Every second an amount of clients come to the registers and we assume that each clients takes 4 seconds to the register before he leaves. Now lets suppose that we get an input of…
0
votes
1 answer

"Translating" a strange pseudocode into python

I'm doing an assignment and in one of the questions, my professor put some strange pseudo code as a condition and frankly I'm not sure if I understood it correctly. This is what he gave us: LOOP if S>0 then {S:=S-1; exit} end_if; END_LOOP can I…
yhware
  • 502
  • 3
  • 13
  • 26
0
votes
3 answers

count occurrences of all numbers in sorted array

assume I have sorted array and I want to count the occurrences of element X. pseudocode: SET Lo to 1 SET Hi to array length WHILE Lo <= Hi SET Mid to (Lo + Hi) / 2 IF X < array[Mid] THEN SET Hi to Mid - 1 ELSE IF X > array[Mid] THEN …
john
  • 45
  • 10
0
votes
0 answers

In place quick sort pseudo code?

I'm trying to come up with a pseudocode description of the in-place version of quick-sort that is specialized to take an array as input and return that same array as output. In this version the array may have duplicate elements. (That is, the…
Vimzy
  • 1,871
  • 8
  • 30
  • 56
0
votes
1 answer

understanding the subset sum to solve resource allocation

I found this code on the internet and i having hard time understanding it. Can anybody give some explanation it will be very helpful. SubsetSum(n, W): Initialize M[0,w] = 0 for each w = 0,...,W Initialize M[i,0] = 0 for each i = 1,...,n For i =…
Jony
  • 6,694
  • 20
  • 61
  • 71