pseudocode Questions

3

Solved

I am trying to understand the MARIE assembly language. I don't quite understand skipcond for doing things like <, or >, or multiply or divide. I am taking this simple program: x = 1 while x...
Bicentenary asked 27/2, 2011 at 23:35

12

Solved

I need to go from milliseconds to a tuple of (hour, minutes, seconds, milliseconds) representing the same amount of time. E.g.: 10799999ms = 2h 59m 59s 999ms The following pseudo-code is the only...
Roush asked 3/6, 2012 at 21:22

9

Solved

If I have a line, with the points x,y,endx and endy how can I detect if another point is on the line? A simple equation, or example functions in JavaScript or pseudocode will be most helpful. EDIT...
Reba asked 28/7, 2011 at 21:20

2

Solved

This question is more generic rather than for a specific language, so I will explain my issue and what I have tried in pseudocode. I am trying to generate a PEM public key from a JWK Set. The JWK i...
Department asked 3/2, 2022 at 15:32

15

Solved

When implementing Quicksort, one of the things you have to do is to choose a pivot. But when I look at pseudocode like the one below, it is not clear how I should choose the pivot. First element of...
Rosemaryrosemond asked 2/10, 2008 at 19:37

9

Solved

Like lots of you guys on SO, I often write in several languages. And when it comes to planning stuff, (or even answering some SO questions), I actually think and write in some unspecified hybrid la...

3

Solved

First, just to give a visual idea of what I'm after, here's the closest result (yet not exactly what I'm after) image that I've found: Here's the entire site-reference: http://www.mathematische-...
Generate asked 3/12, 2010 at 19:58

8

I have been looking for an algorithm to perform a transitive reduction on a graph, but without success. There's nothing in my algorithms bible (Introduction To Algorithms by Cormen et al) and whils...
Practicable asked 6/11, 2009 at 22:33

7

I am working my way through the book Introduction to Algorithms, 3rd edition. One of the first things explained is the insertion sort. On page 18 there is some pseudo code: A = { 5, 2, 4, 6, 1, 3 ...
Renae asked 22/7, 2011 at 10:56

9

Solved

I have two rectangles characterized by 4 values each : Left position X, top position Y, width W and height H: X1, Y1, H1, W1 X2, Y2, H2, W2 Rectangles are not rotated, like so: +-------------...
Bewick asked 15/11, 2012 at 1:37

3

Solved

Just a quick and silly question, about BFS traversal on graphs I found on many sites the pseudocode for a BFS is pretty much something like this: BFS (Graph, root): create empty set S create emp...
Omora asked 10/8, 2017 at 21:29

6

I'm preparing for interviews and I'm trying to memorize Heap's algorithm: procedure generate(n : integer, A : array of any): if n = 1 then output(A) else for i := 0; i < n; i += 1 do genera...

4

Solved

The following pseudo-code is from the first chapter of an online preview version of The Algorithm Design Manual (page 7 from this PDF). The example is of a flawed algorithm, but I still really wan...
Atalanti asked 27/8, 2011 at 19:14

5

Solved

I want to know how to find the LIS of an array using Top Down Dynamic Programming. Does there exist one such solution? Can you give me the pseudocode for finding the LIS of an array using Top Down ...
Brancusi asked 1/6, 2016 at 7:17

4

Solved

I'm looking for an efficient hash function for Rabin-Karp algorithm. Here is my actual code (C programming language). static bool f2(char const *const s1, size_t const n1, char const *const s2, ...
Maenad asked 18/7, 2012 at 17:13

4

Solved

I'm trying to take an array of 3D points and a plane and divide the points up into 2 arrays based on which side of the plane they are on. Before I get to heavily into debugging I wanted to post wha...
Laughton asked 28/3, 2013 at 17:23

17

Solved

I'm looking to generate a random number and issue it to a table in a database for a particular user_id. The catch is, the same number can't be used twice. There's a million ways to do this, but I'm...
Deach asked 26/11, 2008 at 1:44

37

I am trying to create a program that takes a string as an argument into its constructor. I need a method that checks whether the string is a balanced parenthesized expression. It needs to handle ( ...
Wagstaff asked 20/4, 2014 at 21:1

7

Solved

I am trying to test the likelihood that a particular clustering of data has occurred by chance. A robust way to do this is Monte Carlo simulation, in which the associations between data and groups ...
Womble asked 22/11, 2008 at 19:56

13

Solved

I'm about to write a function which, would return me a shortest period of group of letters which would eventually create the given word. For example word abkebabkebabkeb is created by repeated abk...
Kuykendall asked 16/5, 2011 at 17:50

10

Solved

My kids have this fun game called Spot It! The game constraints (as best I can describe) are: It is a deck of 55 cards On each card are 8 unique pictures (i.e. a card can't have 2 of the same pic...
Utricle asked 4/6, 2011 at 23:54

5

Solved

I am interested in evenly distributing N points on the surface of spheres in dimensions 3 and higher. To be more specific: Given a number of points N and number of dimensions D (where D > 1, N >...
Loring asked 20/7, 2019 at 8:55

4

I'm frequently fitting one rectangle into another so that it fits nicely and is centered. I would draw something on the whiteboard and take a picture of what the logic is but it's getting dark and ...
Wiesbaden asked 14/11, 2012 at 18:5

5

Solved

I have a list of numbers. I also have a certain sum. The sum is made from a few numbers from my list (I may/may not know how many numbers it's made from). Is there a fast algorithm to get a list of...
Spanos asked 6/8, 2010 at 4:9

5

Solved

This is a problem I've encountered a few times, and haven't been convinced that I've used the most efficient logic. As an example, presume I have two trees: one is a folder structure, the other is...
Gretta asked 11/10, 2013 at 5:12

© 2022 - 2024 — McMap. All rights reserved.