i := n; WHILE i > 1 FOR j := i to n DO X; END FOR j := 3*i to 3*n DO X; END DEC(i); (* i decrement *) END For this pseudocode, I have to calculate a function f: N -> N, depending on n. I'm doing something...

I have a question where I have to convert from pseudo code into Python and i have an error that goes: Traceback (most recent call last): File "C:/Users/Toshiba/Documents/Stevens stuff/Rings work.py", line 16, in <module> Rings[i] = int(input(("How many teeth are on ring #i ?") % (i + 1))) TypeError: not...

The Bron–Kerbosch algorithm is a method for listing all maximal cliques of a graph. I recently implemented the algorithm successfully just for fun. The downside is that the algorithm is recursive, and thus can only be ran on tiny graphs until the stack overflows. It should be possible to make...

I have pseudo code am trying to implement in python but I cant seem to remember what p ← 0 would mean in logic or calculus. Thanks in advance

I've got a list of random hex values of 3 digits each: List<hex> hexes = "A19", "8EB", "5EF" I'd like to compress them into a list of single characters that can be copied and pasted, then be decompressed later on. For asthetic reasons, it would be nice if they were...

I want to ask how to represents initialization of empty list into pseudocode, my code is following below: cat1 = [] cat2 = [] cat3 = [] cat4 = [] cat5 = [] cat6 = [] cat7 = [] In here I want to ask how to represent those things...

I have a lot of parse trees like this: ( S ( NP-SBJ ( PRP I ) ) ( [email protected] ( VP ( VBP have ) ( NP ( DT a ) ( [email protected] ( NN savings ) ( NN account ) ) ) ) ( . . ) )...

I have this psuedocode, which converts a binary value to a decimal value: int powTwo = 1; int dec = 0; for each character in the string, starting with the last, if (char == '1') dec += powTwo; powTwo *= 2; How do i write the for each loop specified...

I have some accelerometer sensors that gather data every second: AC.X AC.Y AC.Z 9234 -0.98 -0.10 0.03 9235 -0.98 -0.10 0.03 9236 -0.98 -0.10 0.03 9237 -0.98 -0.10 0.03 9238 -0.98 -0.10 0.03 9239 -0.98 -0.10 0.03 The GPS data set gets captured in longer intervals: X1 X2 X3 X4...

I have been working on a function for reducing fractions in Swift, and came across the Euclidean algorithm for finding the greatest common factor (http://en.wikipedia.org/wiki/Euclidean_algorithm) I converted the pseudo code into swift, but yet I am confused how this is going to give me the greatest common factor if it...

I saw this pseudo-code on another stackoverflow question found here Split a string to a string of valid words using Dynamic Programming. The problem is a dynamic programming question to see if an input string can be split into words from a dictionary. The third line, means to set an...

This is a snippet of code. I am unsure how the if statement on the second last line works? It doesn't have a boolean expression like 'if A[n − 1, j] == x' or anything like that. Could someone explain what it actually does to me? Thanks Connected(A[0..n − 1,...

I found on the web a lots of complicated functions and options to see if the string starts with X this all where to complicated or to big how Can I do it in the fastest way for this Pseudocode if price != startswith $ or € echo "<td>Free</td>" else...

So, I do know what a merge sort is supposed to do, and I can somewhat visualize it now. Recursively splitting until only one element is left in the array, since an array of one element is already sorted, it reduces the amount of work needed for each recursion, and...

I have this line of pseudocode that I am trying to translate in Matlab: (maxSum, maxStartIndex, maxEndIndex) := (-INFINITY, 0, 0) I have translated the second and third variables simply assigning a 0: maxStartIndex=0; maxEndIndex=0; How should I translate this line? maxSum= -INFINITY I have not find reference for this....

I have the following pseudocode which a sequential search pseudocode and I am trying to understand what return -1 mean. why would we return -1 could someone please explain. A[n] <-- K i <-- 0 while A[i] != K do i = i + 1 if(i<n) return i; else return...

I have a matrix of size 4 x 10. I want to compute the sum all possible entries of the sum. In other words, if you have a 2 x 2 matrix 2 3 4 1 then there are 2^2 sums (2 + 3, 2 + 1) and (4 +...

I was looking though some pseudocode for some code and I came across the phrase lowest 32 bits of After a very long time of searching through website I came across the answer: What we want to do is AND operation on 64 bit number and 0xffffffff to get lowest...

I have two lines specified by two points with x and y coordinate each. The first point (where the lines begin) is equal meaning that I have 3 points A, B and C where one line is from A to B and the other one from A to C. I...

I'm creating a single function called progress() that is called after a player acts. I think there are only 3 possible ways to end a poker game: Game ends normally, there are 2 or more players until last round ends, do the "showdown" phase, and determine winners Game ends abruptly,...

Consider the following vector (or dataframe or datatable) a = data.frame(x = c(2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1)) x represents a 'state', either 1 or 2. The vector data represents spatial data and I am looking to get the average length per...

I'm experimenting with canvas and I'm trying to modify this piece of code, but unfortunately I don't understand some parts of it. My question is - how to customize the above code to be defined for example by f(z) = c^e(-z) (the formula is taken from a book with fractal...

The randomcoord function was given to me in the project. That's why it's not mentioned anywhere else. This is in pseudocode and I just wanted to check if there is anything wrong with it. The program is supposed to be a game with a 10x10 grid where the player starts...

Anyone has an idea of how to implement an algorithm finding if string match a specific pattern?( not contains it!) without the use of regular expression... Rules are,the pattern can hold sign like ? or *: ? = one character or number * = multiple characters or number or non...

I am working on a small project but have run into a performance roadblock. I have a Dictionary<string, string>() I have a string[]. Lets say my Dictionary has 50,000 entries, and my string[] has 30,000 entries. I want to collect the Keys from my Dictionary where the value.ToCharArray().OrderBy(x => x)...

I need to find the largest triangle of ones in a matrix of zeros and ones using dynamic programming. So if this is my matrix: 1 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0 0 1...