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

Algorithm for checking if an array can be divided into two, such that sum of both of the subarrays is less than a give number

I need an algorithm for checking if an array can be divided into 2, or in general, any number of subarrays (need not be contiguous) such that the sum of all the elements of the array does not exceed a certain number. I believe that it basically has…
0
votes
3 answers

What kind of algorithm do I need?

I'm trying to figure out all the different ways I can create groups of 4 from 6 objects using objective-c. For example, if I had the following objects: a, b, c, d, e, f Then I could create groups like a, b, c, d b, c, d, e a, d, e, f and so on.…
node ninja
  • 31,796
  • 59
  • 166
  • 254
0
votes
1 answer

Pseudocode what is the output?

I am finding it hard to find what this pseudocode outputs. Does it mean for example if you entered the name Peter. Would the output be pet? Or the letter t? Display enter a name Get name Length = length of name Index = length -1 While…
0
votes
2 answers

How would I go about reading bittorrent pieces?

I'm currently developing a torrent metainfo management library for Ruby. I'm having trouble reading the pieces from the files. I just don't understand how I'm supposed to go about it. I know I'm supposed to SHA1 digest piece length bytes of a file…
mkroman
  • 421
  • 1
  • 5
  • 13
0
votes
1 answer

Determining the number of steps in an algorithm

I was going through my Data Structures and Algorithms notes, and came across the following examples regarding Time Complexity and Big-O Notation: The columns on the left count the number of operations carried out in each line. I didn't understand…
Luke Collins
  • 1,433
  • 3
  • 18
  • 36
0
votes
1 answer

Pseudocode for an output statement

How would I write System.out.println("Marvin has " + total + " coins in total"); in pseudocode for an algorithm? I feel like Print "Marvin has" + total + " coins in total is not really pseudocode? This is for an algorithm question on a first year…
Brooke
  • 13
  • 4
0
votes
1 answer

How to mark "seen" RSS entries?

So I have played with the idea of making a specialized RSS-reader for some time now, but I have never gotten around to it. I have several project that could benefit from reading feeds in one way or another. One project for this is an RSS-bot for an…
Christian Wattengård
  • 5,543
  • 5
  • 30
  • 43
0
votes
1 answer

Modification of Dijkstra's Algorithm

I am currently playing around with the very famous Dijkstra's Algorithm, and am a little stuck. I am trying to modify the pseudo code to take an input of BOTH the source and destination, in efforts to find the SHORTEST path between the two vertices…
user4309460
0
votes
1 answer

Converting python long input to pseudo code

example = example + str(i + 1) + ": " + input("Example: ") + "\n" the code above is giving me trouble converting it to pseudo code. I have tried doing something like : take user input for the example, add the example number at the start. Store it…
matvey-tk
  • 641
  • 7
  • 18
0
votes
1 answer

Alphabetical pseudocode for Python

So I've written this code: #input and output files infile = open("unsorted_fruits.txt", "r") outfile = open("sorted_fruits.txt","w") #reading infile Fruits = infile.read() #time to sort the fruit Fruits = Fruits.split() Fruits.sort() for fruit in…
0
votes
1 answer

Returning a specific output on basis of specific set of input

I had been asked to provide the java implementation of the following pseudo code: function  { Input n; //can have either of the two values : 10 or 20 if n == 10   return 20   else   return 10 } I tried following : int…
singhan
  • 27
  • 2
0
votes
1 answer

Bubble Sort - to VB.NET

If I had the following pseudocode, would I need to add anything further onto it as mentioned below. Your help is much appreciated: **repeat swapped = false** for i from 1 <- N for j <- 0 to N - 1 if a[j] > a[j…
Alex
  • 1
  • 1
  • 2
0
votes
1 answer

If statement based on Rapidminer clustering results

After say, a k-means clustering process is run on a set of points and the result is 5 clusters, is it possible to write to a database based on the majority of points within that separate cluster? ie. pseudo: if majority of points within cluster have…
X'Byte
  • 155
  • 1
  • 12
0
votes
0 answers

k-rotated array correctness

I wrote pseudo-code that finds the k'th number in a k rotate-sorted array. A k rotate-sorted array is an array for which A[k]
limitless
  • 669
  • 7
  • 18
0
votes
1 answer

Trigonometric Functions in Pseudo Code

I'm searching for Trigonometric Functions in Pseudo Code. I'm Not good at mathematics, so I can't do much with the formulas in the Wikipedia. Mainly I'm searching for Sine, Cosine, Tangent and the inverse functions (sin⁻¹, cos⁻¹, tan⁻¹) of…
TheEquah
  • 121
  • 8