pseudocode

Calculating check digit for ISBN

This isn't actually homework, I'm just looking through some questions in a discrete maths book before I start computer science next week. Anyway, one of the questions asks me to write a program to perform this algorithm (which it explains). The part I'm stuck with is how to take the 9 digit number and "split" it into single integers, so...

Pseudocode interpreter?

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 language. Although I used to be taught to do this using flow diagrams or UML-like diagrams, in retrospect, I find "my" pseudocode language has c...

Difference among approximatelyEqual and essentiallyEqual in The art of computer programming

I get this code snippet from some where else. According to the webmaster, the code is picked from The art of computer programming by Knuth Since I do not have a copy of that book, may I know what is the difference among the two functions? bool approximatelyEqual(float a, float b, float epsilon) { return fabs(a - b) <= ( (fabs(a) < ...

How to mark "seen" RSS entries?

So I have played with the idea of making a specialized RSS-reader for some time now, but I have never gotten around to it. I have several project that could benefit from reading feeds in one way or another. One project for this is an RSS-bot for an IRC-channel I'm on. But I havent quite wrapped my mind around how I can "mark as read" a ...

How would I go about reading bittorrent pieces?

Hello, I'm currently developing a torrent metainfo management library for Ruby. I'm having trouble reading the pieces from the files. I just don't understand how I'm supposed to go about it. I know I'm supposed to SHA1 digest piece length bytes of a file once (or read piece length bytes multiple times, or what?) I'm counting on your h...

Can you tell me what this code does in pseudocode?

Possible Duplicate: How to convert this C# code to Objective-C This code purportedly does what I need in Objective-C but it's written in a different language. So I'm trying to convert this code to objective-c but I need to understand it better. It would be easier to understand if it was in pseudocode static public IEnumerable...

What kind of algorithm do I need?

I'm trying to figure out all the different ways I can create groups of 4 from 6 objects using objective-c. For example, if I had the following objects: a, b, c, d, e, f Then I could create groups like a, b, c, d b, c, d, e a, d, e, f and so on. Order doesn't matter. If I wanted to figure out all the different possibilities, what ki...

Checking to see if 3 points are on the same line

Hi, I want to know a piece of a code which can actually tell me if 3 points in a 2D space are on the same line or not. A pseudocode is also sufficient but Python is better. Thanks ...

Calculating the shortest distance(perpendicular distance) between a point and a line

Possible Duplicate: Shortest distance between a point and a line segment Hi, I have a point A, and a Line with two endpoint B,C. I want to know how I can calculate the shortest distance between point A and the line formed within B and C. Pseudo-code is enough. Though, Python is preferred. Thanks ...

Determine the optimal combination of coins for a dollar amount

I need to find the most optimal combination of coins that makes up a certain dollar amount. So essentially, I want to use the least amount of coins to get there. For example: if a currency system has the coins: {13, 8, 1}, the greedy solution would make change for 24 as {13, 8, 1, 1, 1}, but the true optimal solution is {8, 8, 8}. I ...

Binary tree, deleting item and reconnecting node

I'm learning data structures and found out that for binary search trees, there are two ways to reconnect node when you delete item. Are those two ways (below) correct? Link to the image to see it non-resized ...

how to create a proper if then else statement for pseudocode and class diagram

First off I apologize for not elaborating and clarifying the question first, so I will do that right now. I am currently trying to complete a a lab exercise (topic is on earthquakes) that requires UML class diagram and pseudocode. one of the method required is named the determineclassification() so for the pseudocode it is required th...

uml classdiagram constructor with parameters

I am a complete ROOKIE at this so I need some help on it. How would you create uml class diagram and constructors with parameters. for default (no parameters) you do policyholder() for diagram and pseudo-code for parameters would you do the same thing policyholder (policynumber, service class, and customer age) for class diagrams an...

Pseudocode/Java Mystery Algorithm

I have an algorithm, and I want to figure it what it does. I'm sure some of you can just look at this and tell me what it does, but I've been looking at it for half an hour and I'm still not sure. It just gets messy when I try to play with it. What are your techniques for breaking down an algoritm like this? How do I analyze stuff like t...

return type of who_user in scilab

greetings and apologies if this is a repost (i searched this site, and i believe its not a repost, though) I work with scilab, but during a project, scilab has to deal with a large number of variables. I was wondering if i can do the following var_list = who_user(); for _var_ = var_list do if _var_ is global then writetofile(huma...

BigO bound on some pseudocode

AllDistinct(a1 , . . . , an ) if (n = 1) return True for i := n down to 2 begin if (LinearSearch(a1 , . . . , ai−1 ; ai ) != 0) return False end return True Give a big-O bound on the running time of AllDistinct. For full credit, you must show work or briefly explain your answer. So the actual answer for this according to ...