Questions tagged [pseudocode]
39 questions
23
votes
6 answers
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 creating another variable called myAnswer and just put…

user1475207
- 349
- 2
- 5
21
votes
4 answers
"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 programmer that I can bounce questions off of.…

Ucenna
- 1,292
- 2
- 10
- 19
21
votes
16 answers
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 and split the coding tasks
Write pseudocode
Get…

Vimal Raj
- 642
- 1
- 4
- 13
19
votes
13 answers
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 it? SO why do we actually use two such words if…

Vamsi Emani
- 1,745
- 7
- 21
- 21
19
votes
8 answers
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 a programming language, but is intended for…

Dynamic
- 5,746
- 9
- 45
- 73
11
votes
3 answers
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 without spending the time to develop an…

Edan
- 221
- 1
- 4
10
votes
9 answers
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 programming, but I have a few questions with…

kullalok
- 1,075
- 3
- 9
- 10
9
votes
4 answers
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 example that in terms of data requirements is…

DJMcMayhem
- 269
- 3
- 12
8
votes
5 answers
what's best platform for explaining pseudo-code to a developer who knows nothing about it?
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 program step as a new row in a table), and then…

gkdsp
- 497
- 4
- 11
8
votes
4 answers
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 others, is it reasonable that colleges switch to…

Asterisk
- 353
- 1
- 7
8
votes
2 answers
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
7 π[s] = nil
8 Q = ∅
9 Enqueue(Q,s)
10 while q…
user145653
7
votes
2 answers
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 coordinate with a vector of the second list.
Of course, I…

manenir
- 179
- 1
- 1
- 3
5
votes
7 answers
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 code to inspire a better/good solution? The…

rrazd
- 1,398
- 2
- 12
- 23
5
votes
1 answer
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 like to find which subsets are common in sets, in…

tigrou
- 269
- 2
- 5
5
votes
1 answer
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 me they look the same.
Also, what exactly is while…
Vetaxili