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

return sum of all non-leaf nodes, binary tree

A binary tree can be encoded using three functions: l, r and k such that for a node n, l (n) gives the left child of n (or nil if there is none), r(n) gives the right child of n (or nil if there is none), and k(n) gives the key value at n. Let…
Hyune
  • 11
  • 1
  • 1
  • 6
0
votes
1 answer

pseudo-code for visiting a state machine

I want to write pseudo-code for visiting a state machine using DFS. State machine can be considered as a directed graph. Following algorithm from Cormen book uses a DFS algorithm to visit a graph. DFS-VISIT(G, u) //G= graph, u=root vertex …
Junaid
  • 1,668
  • 7
  • 30
  • 51
0
votes
0 answers

Two Dimension Array of size 10

starting with programming and would like tips on writing pseudocode for a 2 Dimension array in a main class that stores usernames and passwords for each account. Program should take a username input, store it in the array - preferbly using a…
0
votes
1 answer

Simplification of pseudocode

I am trying to re-write the following pseudocode as the simplest if-else, but am struggling to understand the logic fully. if (a <= b) then // Here, a <= b. if (y > b) then P // Here, (a <= b) & (y > b). else if (x < a) then P // Here, (a…
0
votes
1 answer

python notation form textbook

I have a code snipped from my algorithms text book and i'm have a hard time understanding it. K(0) = 0 for w = 1 to W K(w) = max{K(w - w_i)+vi:w_i<=w} return K(W) i'm confused as to whats happening on line 3 what does the colon mean here? can…
user979490
  • 260
  • 3
  • 11
0
votes
1 answer

Algorithm for multiplication without "*" operator? In pseudocode?

I'm a beginner to programming (learning python right now). Ran across this question, and am completely lost as to how to get the algorithm and how to write it in pseudocode. I'm sorry for asking. I'd really like some help though and would appreciate…
Memo Smith
  • 69
  • 4
0
votes
0 answers

Pseudocode for defining binary file

For describing how an algorithm works you can use pseudocode. What would you use to define a structure of binary file? For instance, I have a file that has the following structure: (n) - int32 containing number of files then, repeated n times: …
RomaValcer
  • 2,786
  • 4
  • 19
  • 29
0
votes
0 answers

Searching element in unknown size array

Given an N sorted elements in the beginning of an infinite array, find if a given k elements exists in the array in O(logN) time, or return proper message if element does not exist. What i have come up with so far is a modification of binary search…
mario vergo
  • 49
  • 2
  • 4
0
votes
2 answers

Generate all permutations of several lists in Java

I have n lists, for example: L_1 = [a_11, a_12, ...] L_2 = [a_21, a_22, ...] ... L_n = [a_n1, a_n2, ...] where ith list has k_i elements. And now, I want to generate all n-elements list, where ith element is from L_i, I mean: [a_11, a_21, ...,…
It'sMe
  • 125
  • 1
  • 15
0
votes
0 answers

Input Validation Pseudocode for Emails?

What would be some basic pseudocode to describe input validation for emails? Something like: Prompt user for email Input == Email ...
dave
  • 41
  • 1
  • 6
0
votes
2 answers

VBA-sort through mailbox and move duplicate subjects to folder

I've run into an issue where i'm writing a macro in Outlook 2013 that goes through an inbox and whenever it comes across duplicate subject lines it moves the 2 emails to a different folder. These "duplicates" have slight differences within the…
0
votes
1 answer

Understanding palindrome pseudocode

For my assignment I have to write and test a Java program to read in multiple lines of input until an empty line is read. After each line is read, I have to determine if the line contains a palindrome and, if it does contain a palindrome, I must…
Lisa
  • 3
  • 1
  • 3
0
votes
1 answer

assembly code confusion? stock at these two problems

the value of status flag bits (0 or 1) after execution of the add instruction. explain mov bx, 8000h add bx, 8000h c this should be 0 because carry flag is not changed? 0 this should be 1 because the sum is not zero? s this should be not…
user4682291
0
votes
1 answer

Convert random hex values to CJK characters

I've got a list of random hex values of 3 digits each: List hexes = "A19", "8EB", "5EF" I'd like to compress them into a list of single characters that can be copied and pasted, then be decompressed later on. For asthetic reasons, it would…
Joe
  • 3,804
  • 7
  • 35
  • 55
0
votes
1 answer

What is .info referring to in pseudocode

I am reading pseudo code for a fundamental linked list and some of the methods have ____.info in them. Here is an example: Algorithm: ToArray() //Returns an array of items from the list START Let Current be a node; Lat ItemArray be an array of items…
Oryx
  • 9
  • 3