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
1 answer

unable to comprehend prims algorithm

Please help in understanding prims algo pseudocode(as it is in coreman and wiki) Prim's algorithm. MST-PRIM (G, w, r) { for each u ∈ G.V u.key = ∞ u.parent = NIL r.key = 0 Q = G.V while (Q ≠ ø) //1 u = Extract-Min(Q) for each v ∈…
shivam_b
  • 21
  • 6
0
votes
2 answers

Displaying even numbers in an array

I need to display the even numbers in an array (in Psuedocode), and I am totally lost on how to do that. This is as far as I have gotten: Begin write_evens(in numbers As Array of Integers, in array_size As Integer) Declare count As Integer …
0
votes
0 answers

How do I recursively determine the maximum number of children that any vertex in a tree has?

function countChildren(node) i=0 m=0 node = LMCHILD(node) while (w is not nil) m = max{countChildren(node), m}; w = RMSIB(w); i++; return max{i,m} I have this so far, but I am tracing it and it…
0
votes
2 answers

Writing algorithm for types of triangle

I am faced with a question that goes like this: Write an algorithm that reads three integers a, b, c representing the sides of a triangle. Next, print the type of triangle represented (scalene, equilateral, isosceles). Assume a valid triangle is…
IT ken
  • 5
  • 1
  • 1
  • 10
0
votes
4 answers

algorithms an pseudocode first year IT

I am faced with a question that goes like this: Write pseudocode that allows a user to repeatedly enter positive integers until an odd number is entered. It would then print the sum of all numbers entered (excluding the odd number). Example:…
IT ken
  • 5
  • 1
  • 1
  • 10
0
votes
2 answers

let insert(L,n) insert natural number n into a singly linked list L. could anyone help me provide a pseudocode description

Doing my CS homework, but have no idea how to write the pseudocode. Let insert(L,n)insert blablabla
0
votes
1 answer

Looking for assistance with Pseudocode

I need some help with pseudocode. The question is as follows: Write pseudocode for a function, processPayment() that processes payment by customers and commits the system to delivering the promised product and service. This function may call…
user3859018
  • 379
  • 1
  • 5
  • 14
0
votes
1 answer

AVL Tree: Finding the key with the smallest data values in keys between two values in O(logn) time

So I'm given an AVL tree. And im trying to figure out at least the pseudocode to find the key with the minimum data values among all of the keys between two values k1 and k2. This is assuming that the field data stored in each node is an integer. I…
MangoOfFury
  • 97
  • 3
  • 11
0
votes
3 answers

Go through Array in O(logn) running time?

Is it possible to go through a boolean array to find a false value in O(logn) running time? The array's indices run from 0 to n-1. If it is, how would we do it in java? Pseudo code is fine.
Vimzy
  • 1,871
  • 8
  • 30
  • 56
0
votes
1 answer

Finding the running time when it comes to constants?

I am attempting to answer some questions that I've come across. I have been watching some videos regarding running time of algorithms. From what I understood, you have to count each operation in an iteration to get the running time. I have the…
user655321
  • 143
  • 4
  • 18
0
votes
0 answers

Pseudocode for finding the maximal coordinate in a set

The maximal points of a set are points that have x and y-coordinates which are greater than or equal to the x and y coordinates of every other point. I have a set whose points are sorted by increasing x-coordinates. This needs to be done…
Julio Revka
  • 169
  • 3
  • 11
0
votes
1 answer

How can I find out if a matrix is an identity matrix using SML NJ?

I am new to this language and I find this a bit confusing. Can you help me with this please? I just have a pseudocode so far. Will you help with the syntax please? The each row of the matrix would be a list and the argument would be list of…
0
votes
1 answer

how to count primitive operations in a while loop in best and worst case?

I understand how to do the for loop but a while with two statements i am not sure. while ( i >0 and x< A[i-1]) maybe break it down into two if statements? if i>0 if x
gds hgff
  • 1
  • 1
0
votes
1 answer

QF pattern matching algorithm pseudocode to c code

the "pseudocode" described at: here BLIM is the fastest algorithm for exact string matching with long patterns. Algorithms 3, 4, 5 are preprocessing algorithms for BLIM and Algo 6 is the actual searching code i need help how to translate those 4…
CutiePie666
  • 69
  • 2
  • 5
0
votes
1 answer

Actions Per Minute formula

I am making a little project for streamers of Twitch.tv. This program will basically measure the amount of times the word "Kappa" is used, per minute, on the website's chat box. Now I was wondering, what kind of formula could I use to measure the…
user2879331