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
4 answers

Recursive algorithm for power of a power

I need to calculate power of a power. For example: 3^2^n . You can think n as input but this example is not the same thing as 9^n. I write a algorithm using loops but now I need to write recursive one. I couldn't find an efficient way to write it.
acalgan
  • 81
  • 9
0
votes
1 answer

Creating an algorithm with better runtime

I have a matrix A with numbers A[1],A[2]...,A[n] and a matrix B (nxn) that i want to save all the possible sums. A simple algorithm that computes the B matrix is: for i=1,2,...,n for j=i+1,i+2,...,n add the number from A[i] to A[j] …
Lee Yaan
  • 547
  • 7
  • 26
0
votes
1 answer

Randomizing a simulation of a real die

I want to simulate the 3D configuration of a real die. I know the sum of opposite faces equals 7 (top: 1 + bottom:6 = 7). Let's say the top face is 1, front is 5, right is 4, back is 2, left is 3 and bottom is 6, as this image suggests. The real…
xickoh
  • 304
  • 3
  • 10
0
votes
2 answers

Simple Pseudocode Code Question

I'm a little new to pseudocode. I understand what the code is saying, but having a hard time putting the pieces together. How should I be thinking to understand what this code is doing: Suppose that a1, a2, . . . , ak is an array of k numbers. What…
bitmoe
  • 391
  • 2
  • 5
  • 13
0
votes
1 answer

Where is the race condition?

I had a question on a test recently that basically said to make 3 concurrent processes execute some block of code in order. Example of execution order incase that did not make sense: P1 P2 P3 P1 P2 P3 ... For my answer I wrote this pseudo-ish…
Danwakeem
  • 328
  • 2
  • 17
0
votes
0 answers

How to take data from a hidden element and post it to a database

I am trying to take data from a hidden element and post it to a database. the hidden element looks like this: As you can see the data is displayed like this, it tracks the…
0
votes
0 answers

Write an assembly language program in PSEUDOCODE. Task 1: Assign an arbitrary positive integer and a integer 2 through 9.

Can someone please help with these assembly language tasks Write an assembly language program in PSEUDOCODE. Task 1: Assign an arbitrary positive integer and a integer 2 through 9. Task 2: Convert the positive integer into a base 2 through 9.…
Peggy
  • 31
  • 1
  • 4
0
votes
2 answers

How to wrap last/first element making building interpolation?

I've this code that iterate some samples and build a simple linear interpolation between the points: foreach sample: base = floor(index_pointer) frac = index_pointer - base out = in[base] * (1 - frac) + in[base + 1] * frac index_pointer…
markzzz
  • 47,390
  • 120
  • 299
  • 507
0
votes
2 answers

Face Detection - Filter overlapping windows

I am writing face detection algorithm, and now I have much windows detected that overlapping. I consider that windows are overlapping if center(windowA) in windowB or center(windowB) in windowA. My algorithm was: resultList <- empty list for each…
zardav
  • 1,160
  • 3
  • 12
  • 22
0
votes
1 answer

Get Latitude and Longitude of upper left corner of a Bing Map

I programatically create requests to dev.virtualearth.net (Bing static maps). I know the following values: Center Point (Latitude & Longitude) Zoom Level Map Size (X pixels, Y pixels) After I recieved the map as a bitmap, how do I determine the…
M.Hoepp
  • 3
  • 3
0
votes
4 answers

Remove child parent relationship recursively from a list

I have a list that contains data row objects which have two attributes, an Id and a prentId. An example would like this: id ParentId 130 -1 131 130 132 131 133 131 134 132 135 131 136 132 137 136 138 136 139 136 143 136 If…
Andy
  • 129
  • 12
0
votes
0 answers

Pseudocode for email address verification (language using is Python)

I would like some help on how to do a pseudocode for checking the formatting of an email is correct. I am using Python but need to plan it out first Generic Rules: 1. alphnumeric before @ 2. @ 3. Alphnumeric after @ 4. . (dot) after @ Thank you
Deborah
  • 1
  • 1
0
votes
1 answer

What would this look like as pseudocode?

I'm trying to implement this: from https://docs.google.com/viewer?url=http://www.tinaja.com/glib/bezdist.pdf&pli=1 The following BASIC program uses the method of finding distance. The program also searches for the minimum squared distance between…
jmasterx
  • 52,639
  • 96
  • 311
  • 557
0
votes
2 answers

software for mac that can help in design phase (UML?)

I am looking for a tool/software that can help me in designing my app. Basically i do not need something like a code generator, but a nice software that let me create blocks where i implement actions (like a class, but just with the declaration of…
user393267
0
votes
2 answers

Does this pseudocode assume a zero based index?

I'm not sure if when they write 1 if this is the first or second element in the array: function DouglasPeucker(PointList[], epsilon) //Find the point with the maximum distance dmax = 0 index = 0 for i = 2 to (length(PointList) - 1) d =…
jmasterx
  • 52,639
  • 96
  • 311
  • 557