Algorithm Definition and 651 Threads

  1. R

    C/C++ How to Create a Spiralling Algorithm in C++ for Printing Patterns

    Hey, I got an assignment to write and algorithm in C++ to print this pattern: 35 34 33 32 31 30 16 15 14 13 12 29 17 04 03 02 11 28 18 05 00 01 10 27 19 06 07 08 09 26 20 21 22 23 24 25 As you...
  2. H

    How to Find the Shortest Path Through N Points in a Weighted, Undirected Graph?

    I've got a small assignment to do on graphs but it's a bit frustrating that no standard algoritms such as Dijkstra, Bellman-Ford, etc. can be used or at least I don't know how could they help. Given a graph one is to find shortest path through N points. That's it. Starting point can be...
  3. M

    Proof of Multiplicative Inverses of Coprime Numbers via Euclidean Algorithm

    Hi I am currently studying Information Theory. Could I please have anyone's ideas on the following question: Using the Euclidean algorithm, show that coprime numbers always have multiplicative inverses modulo each other. I tried the following proof, using Fermat's little theorem, let me...
  4. H

    Complexity of divide and conquer algorithm?

    Let's say I have some algorithm with complexity O(n^k) for some constant k. and let's say it runs in some time T. Now, I want to implement a divide and conquer approach for this algorithm, by dividing the problem in half each recursion. So basically, the first time i run my algorithm it will run...
  5. P

    MATLAB Saving Matrices Generated by Matlab Algorithm

    Hi I have a question, I have to save to file the matrixs generated by an algoritm in Matlab. So i was wondering if is it possibile and how, to use in the filename a variable of the algoritm. Let's say "i" is the counter of my cicle and i would like to save the matrix generated at every cicle...
  6. D

    Proving a Division Algorithm for Real Numbers?

    How might I prove a Division Algorithm for the Real numbers? That is to say, if x, \alpha \in \mathbb{R}, then x=k \alpha + \delta for some k \in \mathbb{Z}, \delta \in \mathbb{R} with 0 \leq \delta < \alpha where k, \delta are unique.
  7. V

    Is My Integer Factorization Algorithm Flawed?

    I am posting an integer factorization algorithm that I have developed. I am hoping for feedback on any obvious flaws that I might have missed before writing a computer programme to test it out. Thanks in advance Visu
  8. I

    Top Algorithm Design Book Recommendations for Non-CS Programmers

    can someone recommend a good algorithm design book? like the end all be all of algo design? so that i don't have to read anything else cause I'm not a cs major just someone who wants to be decent at programming
  9. R

    Expectation for # Exchanges (Quicksort Algorithm)

    Hi I am reading Hoare's original paper where he derives the complexity of quicksort. I am trying to figure how he derives the expectation for the number of exchanges (sorry if this is a very CS-specific question): \frac{(N-r-1)(r-1)}{N} \frac{N}{6}+\frac{5}{6N} I can't see...
  10. B

    Modular Algorithm for Solving Equations with Unknowns Modulo 100

    how can i solve this problem? [ x1= a (mod 100) , a= 20 (mod 37) ] [ x2= b (mod 100) , b= 15 (mod 37) ] [ x3= c (mod 100) , c= 18 (mod 37) ] must be ; x2= a.k + y (mod100) and x3= b.k + y (mod100) i need find b and c.. thank you best regards..
  11. S

    How Do You Calculate a(t+dt) Using the Velocity Verlet Algorithm?

    Homework Statement I am going to use the velocity verlet algorithm to simulate the position, velocity and acceleration at time t of some particle. Homework Equations We got the Langevin equation: a(t) = -v(t)/tau - U'(x) / m + F_f(t) / m Where tau is the mass divided by the friction...
  12. M

    Euclid's Algorithm Homework: Stuck & Need Help

    Homework Statement http://aycu33.webshots.com/image/44152/2001827062284448769_rs.jpgThe Attempt at a Solution pretty stuck...
  13. S

    MATLAB Finding Primes using Algorithm in MATLAB

    Hi all, i understand the following however i don't know how to put this on matlab. any help or hints will be very appreciated. The following algorithm enables us to identify the prime number up to a given integer N, by eliminating all non-primes in that interval. It starts from a lower end...
  14. H

    Data Structures and Algorithm Analysis

    Has anyone here taken this class before? I've been in this class for two weeks, and I still can't get a feel for how difficult or time consuming it may be. My instructor keeps mentioning discrete mathematics (which I haven't taken), although it wasn't a prerequisite for the course. Additionally...
  15. B

    Estimating Pi with Twister Algorithm & Monte Carlo Simulation

    okay new problem here. I am doing a Monte Carlo simulation to estimate pi. The question deals with throwing darts randomly at a board with a radius 1 with a square inscribed in it. I have done a script that randomly selected a number b/w -1 and 1. Then I was supposed to generate the results of...
  16. S

    Fast Algorithm for Determining Path Existence in a Graph?

    Is there an algorithm which is O(1) or O(log n) (basically a very fast algorithm) which can tell whether there is a path from a node A to a node B in a graph? Thanks
  17. E

    The limit of a factoring algorithm

    Hi Ho! It is easy to observe that to get all factors of an integer n, one does not need to try whether a divides n for 1 < a < n. But, rather using the following observation: Suppose n is 24, then 24 / 1 = 24 24 / 2 = 12 24 / 3 = 8 24 / 4 = 6 -------------(!) 24 / 6 = 4 24 / 8...
  18. P

    Levenberg-Marquadt Algorithm (GSL implementation)

    Hello there, I have to fit a one term exponential curve: y = a*exp(-b*t), and I have to implement the fitting procedure in a C program. Some days ago I discovered the GSL (GNU Scientific Library), and I told myself better later than never ;-) When reading the GSL documentation and the...
  19. M

    Developing an Algorithm for Calculating Range of Oerlikon 20 mm Auto-Cannon

    I've been assigned a relatively funky physics project, and the process of writing the algorithm for said project has completely stumped me. I have chosen to research the Oerlikon 20 mm auto-cannon, and have done all of my research and am at the point where I am supposed to write an...
  20. M

    How Do I Design an Algorithm to Convert Height and Weight Measurements?

    Homework Statement The assignment was to design an algorithm that asks for a user's height in feet and inches and their weight in pounds. The output of user's height and weight is suppose to be the user's height in meters and the user's weight in kilos. So I'm basically just suppose to convert...
  21. michael879

    Solving Shor's Algorithm to Factor 15: Results & Analysis

    hey I have a quick question about this. I was trying to understand the QFT operator, so I manually used shor's algorithm to factor 15. I used 2 for the random number. My results seem a bit weird tho. below are the probabilities of observing each number (the correct answer is 4, since the...
  22. Z

    Simplify Decimal to Radical Decimal to Radical Algorithm

    decimal to radical algorithm? does anyone know if there is a method of writing a decimal number in its simplified radical form?? I really would like to know if there is
  23. C

    Deterministic time/space for an algorithm?

    can someone point me to some resources to help find deterministic time and space for algorithms? Is there any software I can download which will help me determine these? Also is there any software which will help me come up with a growth function? Perhaps plotting data etc.
  24. D

    Problem with summation algorithm

    Hi there, I'm trying to right a program for class that 1st assigns random single precission floats from 0 to 1 to the elements 1-d array and then sums them up. Next I'm supposed to compare to this thing called the Kahan summation algorithm for different values of N (array size) using the...
  25. michael879

    Understand Shor's Algorithm & Quantum Fourier Transform

    hey, from what I've read here: http://www.quantiki.org/wiki/index.php/Shor%27s_Algorithm , I understand most of the algorithm. The one thing that I don't get is what the quantum Fourier transform does to the input register. Can someone either explain how this works or what exactly it does?
  26. michael879

    Why is the brute force factoring algorithm exponential time?

    ok so I thought of this factoring algorithm, and I did some quick analysis on it (attached picture, time is in seconds * 5). It appears to be polynomial. However, when I see the basic brute force factoring algorithm I think that's also polynomial. So before I get excited over nothing. Can...
  27. Math Is Hard

    C/C++ Is It Challenging to Write a Perceptron Learning Algorithm in C++?

    Have you ever written a perceptron learning algorithm? http://en.wikipedia.org/wiki/Perceptron Which language did you use? Would it be overly complicated to try to write it in C++ (compared with, say, MATLAB)?
  28. A

    Generic algorithm for probability any propositional formula

    Ciao all, Is there a generic algorithm to compile the probability P(A) of any propositional formula A (provided that we have only the probability of each atoms constituting A)? For example, we have that A= a1 and not (a2 and a3 and ( not a4 and not a5 and not a6 ..) , or any other...
  29. C

    Guessing Number-Generating Algorithm

    Hey everyone. Before I get started on the actual problem, here's a quick background story: Last year my math teacher gave out passwords to check grades online. They were constructed in the following manner - 1st initial, 2nd initial, random 1 digit number. The students in the class...
  30. L

    How to Convert Between Julian Day and Gregorian Date?

    Hi guys, I have another weak problem here if you would care to help, please. I am trying to convert between the julian day and the gregorian date, and I found a eally good website:http://www.ortelius.de/kalender/calc_en.php The only problem is that when I run into the centennial cycle...
  31. N

    Diagonalization Algorithm for Large Matrices: Any Suggestions?

    Does anyone here know of any fast algorithms to diagonize large, symmetric matrices, that are mostly zeros? (by large I mean 300x300 up to several million by several million)
  32. Q

    Ultra-lossless compression algorithm

    About a year ago I came up with an idea for a compression algorithm which could potentially compress any type of data (pictures, movies, text, ect) with equal ability, and could potentially compress it to 1/1000 or less of its original size. It is such a simple idea that I am sure that if it...
  33. A

    Converting an algorithm into an equation

    Hello. I've got a simply ballistics program with a very simply algorithm to deal with air friction. However, I am trying to find a mathematical forumula equivalent. Here is the algorithm: G = accel due to gravity (universal constant) F = projectile air friction factor (constant for a given...
  34. H

    Noise handling algorithm in 8 wire touch screen

    Noise handling algorithm in 8 wire touch screen here's how a touch screen work http://focus.ti.com/lit/an/slaa298/slaa298.pdfProblem: when the touch pen is stationary on a point and reading ADC values from a touch screen using the micro controller, the ADC values are never the same eg, 1st...
  35. Z

    Algorithm Flow Chart: Create Easily & Automatically

    Algorithm flow chart?? I don't know if the exact word is flow chart, It's a direct translation from a french word, it's something that you represent an algorithm with bunch of circles, rectangles, parallelograms, and Rhombus. Anyone know what I'm talking about ? in case someone does, is there...
  36. B

    Algorithm question - totally lost

    Homework Statement Write an algorithm that returns the index of the first occurence of the largest element in the sequence s[SIZE="1"]1,...,s[SIZE="1"]n. Example: If the sequence is 6.2 7.9 4.2 8.9 the algorithm returns the value 4. I am new here...I...
  37. S

    Best ODE algorithm to use for time/velocity independent potentials?

    Hello, I am not sure if this is the right place to ask this, but I don't readily see a "numerical methods" forum here so I assumed this would be the place to go. Sorry if I overlooked another place to post this! Anyway, I have some points interacting via potentials that are dependent only on...
  38. M

    Algorithm for solving system of nonlinear equations

    I'm trying to find an algorithm to solve a 4 variable system of nonlinear equations.. the variables are named w,x,y,z and a,b,c,d are constants: a = x - y + z b = w + x c = y * z d = x * y / w Can anyone offer any advice? Much appreciated...
  39. D

    Calculating Square Roots - Matrix Algorithm

    Hi. I only just recently found out about an algorithm for calculating the square roots of a number. Lets say i want to evaluate \sqrt {n}. I can make an approximation by inspection, and say \sqrt n \approx \frac{a}{b}. Now, using this approximation, i can write: \left[...
  40. F

    Solving Connected Graphs with Algorithm: K Blue/Red Edges

    Homework Statement Given a connected graph G = (V,E). Let n = |V |. Each edge in G is already colored with either RED or BLUE. Devise an efficient (i.e. polynomial-time) algorithm which, given an integer k, 1 <= k <= n − 1, either (a) returns a spanning tree with k BLUE edges and n − 1 −...
  41. V

    What is the most useful algorithm ever written?

    Which algorithm is the most useful and compact that anyone has written?
  42. Mentz114

    Need an algorithm to calculate a function

    I'm trying to calculate a table of x vs t, with x as the dependent variable from this formula t + C = \frac{1}{2}(x\sqrt( 1 - x^2) + arcsin(x) ) C=0.4783 is given when t=0 and x = 1/2 I thought it would be simple but my code is giving nonsensical results, viz. a straight line ! I do...
  43. B

    Write Algorithm to Find the Index of Largest Element in Sequence

    I am having the hardest time getting this algorithm written: Write an algorithm that returns the index of the first occurrence of the largest element in the sequence s1,..., sn. If the sequence is 6.2, 8.9, 4.2, 8.9, the algorithm returns the value 2. Input: s, n Output: ?? I'm...
  44. H

    List of increasing integers algorithm

    Specify the steps of an algorithm that locates an element in a list of increasing integers by successively splitting the list into four sublists of equal (or as close to equal as possible) size, and restricting the search to the appropriate piece. (Hint: see binary search algorithm.) can...
  45. B

    Algorithm to find smallest element

    I'm working on an algorithm that finds the smallest element among a, b, and c. Here is what I have so far: Input: a,b,c Output: small; smallest element in the sequence a,b,c a = 2, b = 4, c = 3 Small = a If b < small, then small = b If c < small, then small = c Is...
  46. H

    Help with Algorithm Homework: Locating Last Occurrence of Smallest Element

    hello any one can help me with this thanx The Horner’s method is an algorithm that evaluates polynomials. The following pseudocode shows how to use this method to find the value of anxn + an-1xn-1 + . . . + a1x + a0 at x = c. procedure Horner(c, a0, a1, a2, . . . , an : real numbers) y...
  47. A

    Quantum Algorithm: Implementing Shor's & Finding Simpler Algorithms

    For a computer science project I am creating a simulation of quantum computer memory structure and operations and implementing Shor's algorithm for number factorization. I have been readings its steps and sort of get it but I want to see a simpler quantum algorithm in action to solidify my...
  48. 0

    Check for Cycles in Undirected Graphs: O(|V|) Algorithm

    I'm just posting a random graph algorithm problem for discussion fodder, since another interesting graph algorithm post was removed due to a threatening-sounding title and lead-up. This is from Cormen, Leiserson, Rivest, & Stein, 22.4-3 (not a homework problem of any kind, just for fun--I had...
  49. S

    Mathematica Solving Math Algorithm Problem with rand(1,1) Function

    Hello I have to write an algorithm that randomly chooses between A B and C. I have to use the function (rand(1,1) which gives me a radndom number from the following (0,1,2,3,4,5,6,7,8,9).. I was thinking of assigning A = 1:3 B = 4:6 C = 7:9 But I run into the problem of the random...
  50. S

    MATLAB How Can I Assign 3 Objects to 10 Randomly Generated Numbers in Matlab?

    Hey there, I was just wondering if anyone in here could help me out with a short algorithm I have to write for my class. Lets say the function fix(10*rand(1,1)) gives u a random number out of (0,1,2,3,4,5,6,7,8,9) now, you need to use the number from the generator to pick out of 3...
Back
Top