Questions tagged [pseudocode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
23
votes
6answers
6k views

Beginner: Why aren't operations contained within output commands?

I'm going through an introductory programming book and it lists a simple example in pseudocode: Start input myNumber set myAnswer = myNumber * 2 output myAnswer Stop Why can't we omit ...
22
votes
16answers
21k views

Should one use pseudocode before actual coding?

Pseudocode helps us understand tasks in a language-agnostic manner. Is it best practice or suggested approach to have pseudocode creation as part of the development lifecycle? For instance: Identify ...
20
votes
4answers
5k views

“Remembering” values in functional programming

I've decided to take upon myself the task of learning functional programming. So far it's been a blast, and I've 'seen the light' as it were. Unfortunately, I don't actually know any functional ...
19
votes
8answers
13k views

What is pseudocode?

I've seen a lot of mentions of Pseudocode lately, on this site and others. But I don't get it: What is Pseudocode? For example, the Wikipedia article below says "It uses the structural conventions of ...
17
votes
11answers
90k views

Difference between a pseudo code and algorithm?

Technically, Is there a difference between these two words or can we use them interchangeably? Both of them more or less describe the logical sequence of steps that follow in solving a problem. ain't ...
10
votes
3answers
569 views

Is there such a concept as “pseudo implementation” in software development?

I'm looking for a label to describe the practice of using human-based computation methods or other means of "faking" an algorithm for the sake of getting a product or demo off the ground quickly ...
9
votes
2answers
5k views

What does pi mean in this BFS algorithm pseudocode?

I have the following pseudocode for breadth-first search algorithm BFS(G,s) 1 for each vertex u ∈ V(G) \ {s} 2 color[u] = white 3 d[u] = ∞ 4 π[u] = nil 5 color[s] = gray 6 d[s] = 0 ...
9
votes
4answers
3k views

What is the most efficient way to store this data?

I am in charge of rewriting some old VB code. I understand how it works, but I feel like there is a far-more efficient way to do what they did. I just can't figure out what it is. Here is a contrived ...
8
votes
4answers
1k views

Why do textbooks use pseudocode rather than real languages?

In colleges and in algorithm textbooks, it is quite common for the teacher and author to explain control flow in pseudo-code. With the advent of more expressive languages like Python and Haskell among ...
8
votes
9answers
20k views

When would I use pseudocode instead of flowchart?

I'm a student working with various techniques of programming, and I've come across pseudocode and flowchart. I know that these are both used in order to think through the problem before actually ...
8
votes
5answers
3k views

what's best platform for explaining pseudo-code to a developer who knows nothing about it? [closed]

I'm a scientific person needing to document complex Matlab code to hand to a developer for him/her to understand and program in a different language. In the past, I've used MS Word (explaining each ...
7
votes
2answers
10k views

Fast algorithm for finding common elements of two sorted lists

Suppose I have two lists of N 3 by 3 vectors of integers. I need to find a quick way (say of running time at most N^(1+epsilon)) to find the vectors of the first list that have the same 1st ...
5
votes
1answer
3k views

Loop invariant vs Assertions

I have an exam on Programming Concepts this Saturday and I am struggling to find some information to understand some concepts better. What is the difference between loop invariant and assertion? To ...
5
votes
7answers
175 views

Can initial inefficient solutions INSPIRE better ones and thus lead to faster problem solving?

When faced with writing an algorithm to solve a small project/problem is it better to come up with pseudo code that isn't efficient/optimum but solves the problem and then try to use the inefficient ...
5
votes
2answers
2k views

Is there a standard pseudocode for parallel algorithms?

The common styles of pseudocode are largely intelligible, and it is more or less clear how to write pseudocode for sequential programs. But if parallelism is not hidden behind a full library and is ...
3
votes
2answers
498 views

Why is design by contract considered an alternative to the pseudo programming process?

Right now I'm reading Code Complete by Steve McConnell and in chapter 9 he talks about the Pseudo Programming Process (PPP). From what I've understood, the PPP is a way of programming in which the ...
2
votes
5answers
443 views

Is it acceptable to ask management for pseudo code? [closed]

I'm a developer in the IT department of a large oil company. I received a spec document, basically in plain English, about business rules that need to be implemented in a new application. The rules ...
1
vote
2answers
503 views

What does “ i , j <— 1”mean in pseudocode?

I'm trying to understand what this pseudocode does and I can't seem to understand what the comma is suppose to do here. I know that j <- 1 is j = 1 but what about the i? And what does j <- j do ...
1
vote
2answers
313 views

What does “if w in [1..5, 8, 11]” mean in pseudo code?

In some pseudocode, I saw the following: if w in [1..5,8,11] Does it mean that if w is from 1 to 5 or 8 or 11? Or is it something else?
1
vote
1answer
1k views

Meaning of infinity sign in pseudocode? [closed]

I searched extensively and cant figure out what the infinity sign is meant in this pseudocode.
1
vote
4answers
6k views

algorithm to print the digits in the correct order

I've been trying to write an algorithm that will print separately the digits from an integer. I have to write it in Pseudocode. I know how to write an algorithm that reverse the digits. digi(n): ...
1
vote
2answers
210 views

Clarification of pseudo random number generator

I am asked to create a pseudo-random number generator using the following algorithm: The generator will generate every integer from 1 to N-1 exactly once The algorithm for N=2^n ...
1
vote
2answers
201 views

Should I write integration test that test my code with real-network servers, before I start writing my code?

I am trying to write integration tests for a client-server app. The client app runs on a user's machine and connects to the server app running on a specific Windows server, network-serverA. The ...
1
vote
1answer
407 views

Estimating time remaining in a queue with multiple workers

I've been trying to figure out a way of calculating the estimated time remaining for an item in a queue when there are multiple workers processing items from the single queue. A client submits a job ...
1
vote
2answers
2k views

Getting the relational table data into XML recursively

I have levels of tables (Level1, Level2, Level3, ...) For simplicity, we'll say I have 3 levels. The rows in the higher level tables are parents of lower level table rows. The relationship does not ...
1
vote
0answers
154 views

concurrency via message queues: how to avoid recursion?

I am working on a concurrency system based on message queues with an underlying thread pool. A queue can target other queues. Also a queue can be targeted by multiple queues (i.e. children) to create ...
0
votes
1answer
116 views

Algorithm to identify differences between two sorted data sets

PROBLEM STATEMENT: Print the items that differ between the following two left and right sorted data sets: A A B C C D D E G F H EOF EOF The proposed solution ...
0
votes
1answer
275 views

Formalising algorithms - Greek symbol uses/sources [closed]

I am looking to formalise an algorithm that I have created, however, I am having trouble knowing how to correctly use Greek symbols (such as Epsilon, Omega etc.). Are there any guides/standardised way ...
0
votes
2answers
2k views

What graph traversal algorithm should I use?

I would like to write an algorithm which can traverse a graph and hopefully later I can implement it to use for an indoor navigation system. The graph would come from floor plans of a building and ...
0
votes
1answer
4k views

Finding common subsets in a list of sets

Let say I have a list of sets, defined like this (3 sets in this example) : A = [1, 2, 3, 4, 5] B = [4, 5, 6, 7, 8] C = [1, 2, 3, 4, 5, 6, 7, 8] Total number of elements defined in sets : 18 I'd ...
-1
votes
1answer
512 views

Pseudocode for an echo using recursion [closed]

Using pseudocode, what would the code for an echo using recursion be? UPDATE: Appears I should have been more clear. By echo I mean the pattern sound exhibits when it echos, not echo as in repeatly ...
-1
votes
1answer
126 views

Aligning text columns of different size and content

In a past posting, I asked about commands in Bash to align text columns against one another by row. It has become clear to me that the desired task (i.e., aligning text columns of different size and ...
-2
votes
2answers
4k views

Algorithm for scheduling shifts

I am trying to write a program to help scheduling shifts for the employees of a small business. There are 28 shifts that needs to be assigned to 28 employees (so this means that each person gets a ...
-2
votes
1answer
74 views

What does this line mean in subset sum problem's pseudocode?

I'm trying to understand the approximate polynomial time algorithm for subset sum problem at Wikipedia, but I stuck at the pseudocode's 3rd line: let T be a list consisting of xi + y, for all y in ...