pseudocode

Programming an algebra equation.

Hi, in another post, MSN gave me a good guide on solving my algebra problem (http://stackoverflow.com/questions/639215/calculating-bid-price-from-total-cost). Now, even though I can calculate it by hand, I'm completely stuck on how to write this in pseudocode or code. Anyone could give me a quick hint? By the way, I want to calculate th...

pseudo code for finding closed paths in a graph

Hi All, I have an adjaceny matrix for a graph which tracks the edges between the nodes by having a 1 in the corresponding adjMat[i,j] = 1; Through this adjaceny matrix i wish to find out all the closed paths of length 4 which exists in the graph. Can anyone please provide me with a pseudo code. thank u ...

What is your best pseudo-code phrase?

Do you have any clever pseudo-code phrases? Maybe a common phrase that has analogous pseudo-code? What's your best one? For example, one I've seen, from bash.org: A programmer started to cuss Because getting to sleep was a fuss As he lay there in bed Looping 'round in his head was: while(!asleep()) sheep++ One I thought of/use: "...

What is the correct caption label for a code fragment?

Hey all, I'm currently working on my Dissertation for my degree, and in writing my report, I don't know how to caption my code fragments correctly. For example... ==================================== Diagram/Image: "Figure 1 - My Diagram" Table: "Table 1 - Tabulated data" Code: "????? 1 - some pseudocode" =========================...

Find the paths between two given nodes?

Say I have nodes connected in the below fashion, how do I arrive at the number of paths that exist between given points, and path details? 1,2 //node 1 and 2 are connected 2,3 2,5 4,2 5,11 11,12 6,7 5,6 3,6 6,8 8,10 8,9 Find the paths from 1 to 7: Answer: 2 paths found and they are 1,2,3,6,7 1,2,5,6,7 implementation found here...

Is this IF statement nested, or not?

input X: if (0 <= X and X < 49) output "abc" else if (50 <= X and X < 70) output "def" else if (70 <= X and X < 85) output "ghi" else if (85 <= X and X < 100) output "jkl" endif ...

Looking for pseudo code for hashing algorithms (open, chaining and multiple)

Greetings, I am looking for the pseudo code for "open", "chaining" abd "multiple hashing" algorithms. Yes I have been searching for a good amount of time at google but I wasn't able to get something good. If you have a link to share, I will be greatful regards ...

Writing pseudocode - Best practices?

I don't want to invite an argument over whether Pseudocode is useful or not here,..there are plenty of questions relating to that. I DO find writing pseudocode useful at times but one thing that crops up all the time is how best do i express it? Sometimes i end up with a numbered approach, other times I'll use a C style syntax but most...

What programming language best bridges the gap between pseudocode and code?

As I write code from now on, I plan to first lay out everything in beautiful, readable pseudocode and then implement the program around that structure. If I rank the languages that I currently know from easiest to most difficult to translate, I'd say: Lisp, Python, Lua, C++, Java, C I know that each language has its strength and weakn...

Is it more efficient to include a "check location" function in a "move function" for a game, or outside as an external function?

I'm creating a game in C++ (speaking of which, does the code I use matter?), which coudl be loosely described as a board game, and I'm wondering which of these two "check if character is out of bounds" functions is more efficient: ONE: int main() { //display board //get player input //move player //if player is out of b...

How much planning do you do before starting to code?

When you're starting a new project, how do you plan for it or how long does it take? Pseudocode? Flowcharts? Do you try to think of all the classes in advance? TBH, i never plan anything. I get straight to it and think of solutions as problems arise. Mostly because the few times i tried planning in advance, i would always forget somet...

Pseudocode check. Complete Coding Noob needs validation for assignment

I have already turned this in so you won't be helping me cheat. Just wondering if this looks right: The assignment: Input a list of employee names and salaries, and determine the mean (average) salary as well as the number of salaries above and below the mean. The Plan: Allow input of names and salaries Calculate Mean Sort values Count...

Folder searching algorithm

Not sure if this is the usual sort of question that gets asked around here, or if I'll get any answers to this one, but I'm looking for a pseudo-code approach to generating DB linking records from a folder structure containing image files. I have a set of folders, structured as folllows: +-make_1/ | +--model_1/ | +-default_versi...

Ruby Code Translation Request

I have negligible Ruby syntax knowledge and was hoping someone would be kind enough to translate the function below into pseudo code and possibly provide an example of how it would be called? def in_list(num, list) list = [*list] list.each {|a,b| return (b)? num.sub(a,b) : a if num =~ a} nil end ...

Building string programatically and dealing with trailing or leading boolean operators

I am using Lucene in an application. As such I have a form that lets users build a query by selecting what they want to search from dropdowns. Once a user submits, I build the query and it comes down to something like this: var formedQuery= string.Empty; foreach(var field in fields) { if (field.name != 'condition so you never know w...

Algorithm to return length of shortest branch in a binary tree

A binary tree can be encoded using two functions l and r such that for a node n, l(n) give the left child of n , r(n) give the right child of n. A branch of a tree is a path from the root to a leaf, the length of a branch to a particular leaf is the number of arcs on the path from the root to that leaf. Let MinBranch(l,r,x) be a simple...

Pseudo-code for shelf-stacking

Suppose I have some serially numbered items that are 1-n units wide, that need to be displayed in rows. Each row is m units wide. I need some pseudo-code that will output the rows, for me, so that the m-width limit is kept. This is not a knapsack problem, as the items must remain in serial number order - empty spaces at the end of rows a...

What or where is this basic pseudocode flowcharting program?

I'm looking for a specific program I've seen 2-3 people use in college that automatically generated flow charts from pseudocode. I've looked at every link I could find in the 20+ flowcharting threads here on S.O. I did not see the one I am looking for, I've googled and no luck. A fairly simple, flow chart would actually be generated by...

Shortest branch in a binary tree?

A binary tree can be encoded using two functions l and r such that for a node n, l(n) give the left child of n, r(n) give the right child of n. A branch of a tree is a path from the root to a leaf, the length of a branch to a particular leaf is the number of arcs on the path from the root to that leaf. Let MinBranch(l,r,x) be a simple ...

Pseudo-code question from some MIT courseware

I've never had much need for writing large quantities of formal pseudo-code but the need has arisen, so I thought I'd pick some standards in order to stay consistent across code. To that effect I picked up some "iTunes U" courseware videos, amongst other things the 6.046J / 18.410J Introduction to Algorithms (SMA 5503). In the very fir...