Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pseudocode]

The tag has no usage guidance.

0
votes
0answers
15 views

Pseudocode for Userdefined Data Types

In the pseudocode guide for my syllabus, an example of a record data type is given as below: ...
-1
votes
0answers
15 views

Understanding constraint satisfication problem : N-Queen Problem

I am searching pseudo code of Forward Checking-Minimum Remaining Value and Forward Checking-Lease Constraint Value.I try google but no more than show words.I am trying to understand these two ...
0
votes
0answers
9 views

Where can I find the algorithm in pseudocode for deleting a key from a B-Tree?

I am reading the chapter on B-Trees in Introduction to Algorithms (3rd edition) by Cormen and found the deletion procedure very confusing. I could understand the algorithm for insertion because it ...
0
votes
1answer
23 views

Divide and Conquer Algorithm to calculate $a^n$

I am attempting to create an algorithm which given the value of $a \in \mathbb{R}$ and $b \in \mathbb{N}$, calculate $a^n$. So for example, using the Java language pattern, the algorithm will be ...
0
votes
1answer
26 views

For Loop Range with Smaller Number on Right

Simple question from an algorithm noob... If $i=1$ then the inner loop will include what I believe to be an invalid range. Is this acceptable pseudocode? ...
0
votes
0answers
42 views

Modifying Dijkstra’s algorithm such that it finds a path whose longest edge is as short as possible

I want to modify Dijkstra’s algorithm such that it finds a path whose longest edge is as short as possible. My idea: ...
0
votes
0answers
27 views

Writing pseudocode for a paper, some hints and guides?

First of all, I know, pseudocode has NO RULES! There are some latex packages that support the default sentences (for, while, etc.), but there's no official notation on how to set the array, or value ...
0
votes
1answer
107 views

Help writing a dynamic programming algorithm in English

It’s Friday night and you have $n$ parties to go to. Party $i$ has a start time $s_i$ end time $t_i$ and a value $v_i \ge 0$. Think of the value as an indicator of how excited you are about that party....
0
votes
1answer
16 views

CLRS pseudocode involving both subscripting and property access of a data structure

In Introduction to Algorithms, the stack data structure's enqueue operation has the following pseudocode ...
1
vote
1answer
156 views

Probability that a random hash from a universal family is injective

This is a homework question, I don't want an actual answer, but rather guidance on how to obtain the correct answer. The question is as follows: In class we saw universal hashing as the solution to ...
1
vote
1answer
77 views

Answering questions about the recurrence of certain aspects of an algorithm

I am thoroughly confused by a problem that was brought up in class: Given the following pseudocode for a function RANDOM which generates a random number based off of recursion: ...
-2
votes
2answers
75 views

Writing pseudocode to be language independent

There exist 5 rules for any pseudocode , one of these rules is : "Keep statements language independent" I don't understand what is this rule is saying. So can someone explain it and then give an ...
14
votes
2answers
4k views

Will this program terminate for every Integer?

In a Part Test for GATE Preparation there was a question : f(n): if n is even: f(n) = n/2 else f(n) = f(f(n-1)) I answered "It will terminate for all ...
1
vote
1answer
37 views

Balance groups based on average, element constraints and size

It's a complex situation, where I want to balance groups of numbers based on the average of these numbers, while keeping the group size unchanged and not breaking elements constraints. Let me explain ...
0
votes
3answers
33 views

What is the most used way to write for-loop as pseudocode?

for $e\leftarrow1$ to 8 do for $e\in[1,8]$ do for $e\in\{x\in\mathbb{N}|1\le x\le8\}$ do What is more preferred?
1
vote
1answer
62 views

What sort of code is this?

Here is a question I encountered:- Read this section of program code that inputs 10 positive numbers and then outputs the smallest number input. Identify three changes you would need to make to find ...
1
vote
1answer
233 views

Doubt on declaring an array in pseudocode

So here's the code:- DECLARE number as INTEGER PRINT "Enter a number" INPUT number DECLARE randomarray [1:number] AS INTEGER Is this possible? i.e whilst declaring arrays, can we use variables? ...
0
votes
0answers
21 views

Algorithm steps or Matlab Code to Create Mixture Design

Can you please put code or algorithm steps to create mixture design or space filling design. Also, what are alternative approaches to mixture design.
2
votes
1answer
25 views

Notation for field access in Algorithm

While writing array index in an algorithm $a[i]\gets v$ is conventionally used. Is the notation $a_{i}\gets v$ also used ? If the algorithm uses struct or ...
-1
votes
1answer
97 views

How does this algorithm expressed in pseudo-code work?

On a website it gives you questions and answers for computer science, yet does not explain the answer. I was hoping if someone could explain the pseudo-code (answer) for me, as I do not understand it. ...