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

Modify Dijkstra algorithm to find the shortest path

Here is Dijkstra pseudocode: Dijkstra(G,s) { foreach vεV do { d[v] = infinity } Queue priority initialization Q with n elements Q = V d[s] = 0 while(Q is not empty) { v = ExtractMin(Q) foreach e = (v,w) ε E do if d(w) > d(v) + l { …
Lee Yaan
  • 547
  • 7
  • 26
0
votes
2 answers

find difference between two selected hours

I have two selected hours that is taken from 0-23 range. How to programatically calculate difference between them? For example, diff between 22 and 4 would be 6, 22 and 24 - 2.
mk_yo
  • 752
  • 1
  • 12
  • 39
0
votes
1 answer

MATLAB: The input character is not valid in MATLAB statements or expressions

I am making a Mersenne Generator in MATLAB and I am using the code as follows: %// Define parameters a=65539; c=0; x0=1; m=2^31; %// Calculate sequence using recursion relation xn=zeros(20000,1); for i=1:20000 …
0
votes
0 answers

B-tree in pseudocode

In order to understand B-tree-algorithms I'm trying to write such in C style pseudocode. I suppose a B-tree algorithm is like a linked list but with an array of pointers and an integer that with the value of the length of the array. Am I right?…
0
votes
1 answer

Q: Randomised character creation using a points system

This is more an abstract "How would I approach this" question than me struggling with coding. I want to make a character creation screen where you have 0 points but can take away from one stat and put it into another. How, under this system would…
0
votes
1 answer

Draw an Arc from a start point, end point and a radius

I'm looking to get a point list of n points on an arc; I will know the start point, end point and radius. The user would be building an arc with 3 mouse clicks, the first two to define the start and the end and the third to would set the size of the…
Questioning
  • 1,903
  • 1
  • 29
  • 50
0
votes
1 answer

What is the fastest algorithm to find all permutations one array can be arranged without having any two elements in the same order?

The practical application of this algorithm is to assign each person in a group of 2..N people a different target person from the same group of people for as many consecutive rounds as possible. I'm representing the group of people as an array. The…
Markus Rautopuro
  • 7,997
  • 6
  • 47
  • 60
0
votes
1 answer

Converting Merge Sort pseudocode to running Java code

I tried to convert this Merge Sort pseudocode into Java but don't get the right output. Here is the pseudocode: Merge-Sort(A, p, r ) if p < r then q←(p+r)/2 Merge-Sort(A, p, q) Merge-Sort(A, q + 1, r ) Merge(A, p, q, r…
Peter Winzer
  • 165
  • 7
0
votes
2 answers

select equal sized number groups from a sequence of random numbers

say i have a list of 100 numbers, i want to split them into 5 groups which have the sum within each group closest to the mean of the numbers. the simplest solution is to sort the hundred numbers and take the max number and keep adding the smallest…
0
votes
3 answers

Explanation to an assignment

I am NOT looking for an answer to this problem. I am having trouble understanding what I should be trying to accomplish in this assignment. I welcome Pseudo code or hints if you would like. but what I really need is an explanation to what I need to…
0
votes
0 answers

Designing an algorithm that keeps traffic equally distributed over a network

My question isn't related to how to code a particular thing or any technical programming question. I need help in developing a logic of an algorithm that I am working on which I will be explaining in a bit. I am here because I couldnt think of a…
0
votes
0 answers

Save State of Random Number Generator C#

This is under the assumption that if I make a new random number generator and feed it a seed it will always repeat the same pattern at run time for example lets say my random number generator outputs the following, one digit at a time: 123456789 Is…
UpTide
  • 307
  • 3
  • 13
0
votes
1 answer

I need help writing pseudocode for findAll(k) method in binary search table

This is from an assignment. The exact question is: "Design a variation of binary search algorithm for performing the operation findAll(k) in a search table (i.e., a map which is implemented using a sorted array and which allows multiple entries with…
Jonathan
  • 55
  • 8
0
votes
1 answer

Modify Insertion Sort Algorithm to be Non-increasing

I am wondering how I can change the output of insertion sort into non-increasing order? For example 537 would be 753. Also, would the runtime would be the same compared to increasing (both best and worst case)? Pseudo Code: INSERTION-SORT(A) …
user3393266
  • 59
  • 2
  • 9
0
votes
1 answer

Parsing CSV of files paths line-by-line [Logic Request]

I have a tricky data set to parse through and have not been able to formulate a processing method for it and several failed ideas have just made me more confused... Sample data in CSV format - before…
hhauewuew
  • 3
  • 1