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

Java coding converted to pseudo code

I have to convert this Java code to pseudocode. The program accepts 2 times and returns the time span in minutes. In Java we have int hr1_int and int hr2_int so what they will be in pseudo code? And the String , sub-string, parseInt, try-catch…
Tran Minh Quang
  • 1
  • 1
  • 1
  • 2
0
votes
1 answer

Pseudo Code Algorithm: finding number of iterations + best/worst case scenarios

Given the following pseudo code, I am supposed to find out how many times the statement in the innermost loop is executed, as a function of n, and what the best and worst case scenarios of order of operations of this algorithm is. Algorithm…
0
votes
1 answer

Distribution using the Poisson Point Process model

I need to use the Poisson Point Process (PPP) model to randomly distribute a set of 'objects'; over a given area: Let's say that we have N objects to distribute over an area that has been split equally into S subsections. How might I use PPP to…
user3352349
  • 177
  • 2
  • 4
  • 16
0
votes
0 answers

Splitting values equal parts

Somehow I can't think of the solution which is probably simple once mentioned. So I need to make a program where I need to divide in equal parts. given: 5 types of classes (say mechanics, it, management etc) 400 students each class can contain a…
DaViDa
  • 641
  • 1
  • 8
  • 28
0
votes
2 answers

Faster way to convert 1D -> 3D using powers of 2 dimensions

I'm trying to optimize accessing and changing data of a 3D environment, because some operations have to be done millions of times. Currently I have the following optimizations in place: Using a flat array (1D) The dimensions are in powers of…
Neijwiert
  • 985
  • 6
  • 19
0
votes
2 answers

replacing "with" statement in Python code

import json with open("login_data.txt", "r") as login_file: try: users = json.load(login_file) except: users = {} Recently, I'm doing a presentation for my code. However, my lecturer requires me to break down the code into…
0
votes
3 answers

What does >> mean in pseudocode?

I recently saw that representation in here: https://en.wikipedia.org/wiki/Modular_exponentiation#Right-to-left_binary_method 'exponent := exponent >> 1' what does it mean?
D. Johnson
  • 25
  • 4
0
votes
1 answer

Is there some error on this BubbleSort pseudocode? (or I'm taking it wrong)?

I saw this on a book: BubbleSort( list ) length <-- lenght of list do { swapped_pair <-- false index <-- 1 while index <= length - 1 { if list[index] > list[index + 1] { swap(…
Coder88
  • 1,015
  • 3
  • 10
  • 23
0
votes
1 answer

How these pseudocodes for bubble sort works?

I got this pseudocode from Wikipedia: procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false for i = 1 to n-1 inclusive do /* if this pair is out of order */ if A[i-1] > A[i] then …
Coder88
  • 1,015
  • 3
  • 10
  • 23
0
votes
1 answer

When to stop agglomerative hierarchical clustering - stopping criteria

I am coding my application each function so i am not using tools which does everything for you Been looking for solution when to cut my agglomerative hierarchical clustering How do i cluster? I have coded application in c# 4.5.2 So far i am using…
0
votes
2 answers

how to use looping and array with php

I am newbie in programming php, i have output query data from database like this name activity payment english activ A 20 english activ B 25 english activ c 30 biology activ d 50 biology activ e 60 but i want to show output like…
0
votes
0 answers

How do I represent input-process-output in pseudo-code?

For my class in programming I was given this assignment: Write pseudocode to represent the logic of a program that allows a user to enter two values then outputs the product of the two values I wrote: start input takeOne input takeTwo …
0
votes
1 answer

A widget with toggle functionality

I am trying to create a widget which has one ImageView. I want it to work like a toggle button. One a click, it should do one thing and, on another click do a different thing, and repeat. I have stumbled a lot of tutorials on widget and many posts…
TheOnlyAnil
  • 877
  • 1
  • 15
  • 27
0
votes
0 answers

Random numbers with no repeats with memory constraints

I want to pick random numbers without repeats between 0 and a very large number, say, 2^64. I'll do this a lot of times and I don't have much RAM, so I can't just store the numbers that have already been used and compare each new number with that…
ItsAmy
  • 844
  • 1
  • 6
  • 20
0
votes
3 answers

What means for i=a,1,-1 in pseudocode?

I have a code in pseudocode. This is a line of code: for i=k1,1,-1 do Ti <- Ti-1 + Ti. k1 is an integer. Ti is an array. The question is: what means for i=k1,1,-1? I know what is for but I don't know what is i=k1,1,-1. Thank you!
MM PP
  • 4,050
  • 9
  • 35
  • 61