Skip to main content
Filter by
Sorted by
Tagged with
5 votes
2 answers
130 views

In his classical paper Permutation Generation Methods, Computing Surveys 1977, Robert Sedgewick presents his "Algorithm 1" on page 140 like this: procedure permutations(N); begin ...
Hubert Kauker's user avatar
-1 votes
1 answer
55 views

I want to turn a variable (let's say with a current value of 20) into a value that is <variable> minutes (in to), so a variable of 20 turns into 1200 (the number of seconds in 20 minutes) How ...
Cobalt's user avatar
  • 3
1 vote
1 answer
130 views

Specifically: Write a function (in python, java or pseudocode) average(nums) that prints the mean of the numbers in list nums, and returns a tuple: The tuple's first element is the index of the ...
anf's user avatar
  • 43
2 votes
1 answer
139 views

The A* search algorithm is usually implemented using an open and a closed list (or other data structures). Recently I read in Wikpedia a pseudocode that makes use only of an open list. Is the closed ...
Sam's user avatar
  • 494
1 vote
1 answer
279 views

Here is a problem that was in a past exam for Advanced algorithms in my studies,it's on 5 points over 3 hours so should take approximately 1H but I am struggling to find the solution for the first ...
Solal Peiffer-Smadja's user avatar
1 vote
2 answers
77 views

I wrote the following pice of pseudocode. It is about the classic producer-consumer queue in multithreading, but I am trying to add a graceful shutdown mechanism. I want consumeItem to keep working ...
RutgerBlume's user avatar
0 votes
1 answer
75 views

I came across a practice problem: I already wrote out the pseudocode for this, really easily too, just made the calls to the function as mention in the problem statement. But I was really struggling ...
FlarrowVerse's user avatar
-1 votes
1 answer
89 views

The input is an N by N matrix of numbers. Each individual row is increasing from left to right. Each individual column is increasing from top to bottom. The example of a matrix is given below with N = ...
Rafat's user avatar
  • 1
-2 votes
1 answer
84 views

Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average (using integer division) and max. A ...
Grace Fitz's user avatar
2 votes
2 answers
164 views

I have an input string S and three parameters: a prefix string (denoted by A), a suffix string (denoted by B) and a set N of strings. Given these three parameters, is it possible to generate a single ...
lyrically wicked's user avatar
2 votes
1 answer
115 views

I wanted to get a sanity check here. I believe the algorithm listed on the wikipedia page for the Day–Stout–Warren algorithm for balancing BSTs has a problem. This pseudocode purports to turn a BST ...
Paul C's user avatar
  • 8,439
-1 votes
1 answer
89 views

I'm a graduate student in biology that encountered a problem that I really struggled solving in my project. I solved it using an iterative approach (will describe more below) but was curious if there ...
Betelgeuse's user avatar
2 votes
1 answer
99 views

Each street in Monopoly is comprised of 2 or 3 different properties. When a user upgrades a street, it will build 1 of 3 buildings on the appropriate property. House - least valuable, will build this ...
Will's user avatar
  • 408
1 vote
0 answers
110 views

How can I calculate the maximum possible sum of vertices in a weighted DAG excluding vertices directly connected by an edge? This is a vertex selection problem where each vertex has a weight. In this ...
Asher Ross's user avatar
1 vote
1 answer
108 views

GOAL The goal is to use a chained hash table, with a hashing function h that satisfies the Simple Uniform Hashing Assumption, to store some numbers (the same number, if inserted multiple times, is ...
selenio34's user avatar
  • 202
0 votes
1 answer
73 views

I have been stuck trying to figure out how to translate pseudo code into hack language formatted as .asm, that will run successfully using the CPUEmulator.sh in the Nand2Tetris, with attached .tst &...
bigtim201's user avatar
-2 votes
1 answer
39 views

I currently have a process in place, but need to reformulate it to be more efficient. I will describe the new process and I would like to know if the new process is optimal and follows proper coding ...
feonyte's user avatar
  • 199
1 vote
1 answer
77 views

Given the coordinates of the top left corners of two rectangles (x1, y1), (x2, y2), their respective widths and heights (w1, h1), (w2, h2) (They may or may not overlap). How do I find the coordinates ...
jus0521's user avatar
  • 23
1 vote
1 answer
273 views

Problem: A ball is thrown up after sometime it loses momentum and starts falling back A car moving in direction x and taking a U-turn & starts returning A planet moving prograde and becomes ...
AviD1511's user avatar
  • 149
-1 votes
2 answers
189 views

how do i replace if else to && || if the output for each condition is the same in these cases there are multiple different conditions to be met before reaching the outputs and each case has ...
ulti's user avatar
  • 25
-4 votes
1 answer
268 views

The answer for all three situations is supposedly 3, i dont understand why that is, can someone please explain what is going on and the reasoning behind it, why is the answer 3 for all situations ? I ...
Girlwhoisnewtocode's user avatar
-1 votes
1 answer
132 views

I have a question and I hope someone could help me. I really don't understand the pseudo code of the merge step of the merge sort algorithm. I understand how it works but not the code. Would be ...
luna_98's user avatar
0 votes
0 answers
76 views

The problem I marked in the picture is choosing the shortest path for the greedy and Dijkstra algorithms, now I'm confused because there are 2 identical paths, namely B to C and B to D. Which path ...
Mks Akbar's user avatar
1 vote
2 answers
89 views

So I've got an interesting problem here that I'd like to find an elegant solution to. In this case, I don't really have any code written as what I'm looking for is more of an algorithm. Once I know ...
Osuwariboy's user avatar
  • 1,385
1 vote
3 answers
232 views

I am trying to meet these requirements: Cards should be drawn in a pseudo-random order, Hearts and the Ace of Spades will be considered special cards with increased chances of being drawn. Each Heart ...
karrjm's user avatar
  • 19
0 votes
2 answers
341 views

I was studying about Linked Lists from the book, "Introduction to Algorithms" by T Cormen. There was an portion in the book as follows: Given an element x in the list, x.next points to its ...
Thomas Finley's user avatar
0 votes
1 answer
1k views

Write a pseudocode on implementing a queue through an array named Q of size n with 1-based indexing( i.e the index of Q starts from 1 instead of the usual 0). The two functions below called Q.head and ...
Thomas Finley's user avatar
0 votes
1 answer
133 views

One may consider using case rather than if-then-else statements. If there are different cases, then the code goes to the right choice. This will save time without going through everything. If f_op is ...
husin alhaj ahmade's user avatar
0 votes
0 answers
171 views

My assignment is to write Pseudocode for a program I was told to create. The Color Mixer program in Python. Here are two examples of how to write the Psuedocode out of the book I was told to read. ...
Brandon Parker's user avatar
2 votes
2 answers
465 views

For a pseudocode algorithm like this: Algorithm fn(A, S): Inputs: array A of n integers integer S for i from 0 up to n - 1: for j from i + 1 up to n - 1: for k ...
Software Guy's user avatar
0 votes
1 answer
600 views

I am trying to create a multiplication table from 1 to 10, but print each line one at a time. I need to know how to do this in flowgorithm. I have the chart correct to print the multiplication table ...
Rashad Vaughn's user avatar
1 vote
1 answer
134 views

Suppose we have 2 sequences(Arrays) A[1..m] and B[1..n] of integers. How can we find the length of the biggest common contiguous subsequence of A and B in O(nlogn + mlogm + k^2) where k is the number ...
Navid Naseri's user avatar
0 votes
1 answer
56 views

I have a graph with two lines that measure the volume flow of some goods. Every 5 minutes I receive new points for two lines. When I visually see that two lines are next to each other and go through ...
Madi Kalygin's user avatar
-1 votes
1 answer
209 views

I was trying to figure out a way to sort a linked list in ascending or descending order, but because a linked list is accessed only sequentially, I don't know how to do it, let me explain it better, ...
Gabriel Burzacchini's user avatar
0 votes
1 answer
51 views

I am working with pseudocode taken from Exploration Tools (section "Arm A64 Instruction Set Architecture", button "Download XML"). bits(16) BFSub(bits(16) op1, bits(16) op2, ...
pmor's user avatar
  • 6,775
1 vote
0 answers
235 views

I am iterating a tree using Breadth first search and I want to check whenever the iteration goes to a lower level in the tree each time to display a message and that using a pseudo code. I don't want ...
Sam's user avatar
  • 591
-2 votes
1 answer
79 views

I partially understand what the question is asking but why are all answer choices not right?
Pranavi Kedari's user avatar
0 votes
3 answers
773 views

Would this be the correct way to use a WHILE and DO…WHILE loop? These two examples of a loop were suggested to me by another user so, I thought I would pop them into my pseudocode to see how they ...
Heidihale58's user avatar
0 votes
1 answer
526 views

I've been creating a program that determines the number of paint cans required to paint a room. My professor had us write the pseudocode for the program, and now wants us to modify the code by ...
Heidihale58's user avatar
0 votes
1 answer
2k views

I was asked to design a pseudocode that calculates and displays a person's body mass index (BMI) based upon their weight and height. I would like to know if I'm headed in the right direction or if I'm ...
Heidihale58's user avatar
0 votes
1 answer
81 views

I am trying to code the IBM Modele using its pseudo-code And I believe my code should work but for different iteration numbers the output is printing the same and I have no idea why this is happening....
Emin-35's user avatar
  • 73
-2 votes
1 answer
557 views

I need much a correct pseudocode of Bron–Kerbosch algorithm (it enumerates all maximal cliques in an undirected unweighted graph). I need iterative (non-recursive) solution with a stack. And the ...
ttnphns's user avatar
  • 137
0 votes
1 answer
599 views

I am working on writing the pseudocode for a calorie counting program that calculates the total weekly calories for breakfast. the program should allow the user to enter the number of calories ...
Heidihale58's user avatar
0 votes
0 answers
160 views

I need help in writing a python code that takes in the Three Address Code for the Java source code and returns pseudo code. I have successfully generated pseudo code for 1-D array initialization by ...
Jasleen Kaur's user avatar
-1 votes
1 answer
704 views

Below is the pseudo-code. In my opinion, it is the pseudo-code is trying to find the peak elements along with their index in a list of tuples. The output on my end is : [(1, 4), (4, -9), (7, 12), (9, -...
Aman Raheja's user avatar
-1 votes
1 answer
42 views

I need to loop through an array and be able to create a populate an array using pseudocode or python. I have tried to create and populate an array, but cannot loop through the values.
Karina Shinn's user avatar
1 vote
1 answer
103 views

During an interview I was given the following problem: From the following puzzle, what would the output of puzzle(power(2022, 100)) be? function puzzle(N) { A, B, C, D = 1, 1, 1, 1 .repeat N ...
Lautaro Graciani's user avatar
2 votes
1 answer
658 views

In my book, Programming in C (fourth edition) by Stephen G. Kochan, I have a task to implement the Sieve of Eratosthenes algorithm as follows: Display All Prime Numbers Between 1 and n = 150 Step 1: ...
Brandon12's user avatar
-1 votes
1 answer
252 views

I am looking at the truth table for following pseudocode. IF year = 11 AND (grade < target OR target >7) THEN SET revision_class TO true END IF I want to know whether the below truth table ...
Norvin's user avatar
  • 21
0 votes
0 answers
62 views

I was attempting a problem regarding pointers from a book called problem solving and program design in C. we were formally introduced to functions fscanf() and fprintf() where they accept both input ...
IdeadlySkies's user avatar

1
2 3 4 5
39