Algorithm Definition and 651 Threads

  1. PsychonautQQ

    Division Algorithm for Polynomials in R[x] confusing me

    I will be using /= to mean 'does not equal'. From my textbook: Division Algorithm: Let R be any ring and let f(x) and g(x) be polynomials in R[x]. Assume that f(x) /= 0 and that the leading coefficient of f(x) is a unit in R. then unique determined polynomials q(x) and r(x) exist such that 1)...
  2. evinda

    MHB Divide Binary Search Tree at Key k: Algorithm & Analysis

    Hello! (Wave) Given a binary search tree $B$, I want to write an algorithm, that divides $B$ into two new trees $B_1, B_2$, so that the first one contains all the keys of $B$ that are smaller than $k$ and the second one contains all the keys of $B$ that are greater than $k$. Hint : Execute a...
  3. evinda

    MHB Writing an Algorithm to Check Depth of Leaves in an Ordered Tree

    Hello! (Wave) I want to write an algorithm, that implements an ordered tree(not necessary binary tree). It should check if all the leaves of the ordered tree (that is implemented from the binary tree) are at the same depth. Could you give me some hints how I could do this? (Thinking)
  4. M

    MHB What Are the Focus Areas in the Course Algorithms and Complexity?

    Hey! :o I take the course Algorithm and Complexity and I have to choose one of the fields Computer Science(the operations of a computer), Computational Geometry or Cryptography. Could you give some information about these fields?? (Wondering)
  5. B

    How does the Karplus-Strong algorithm work?

    http://en.wikipedia.org/wiki/Karplus%E2%80%93Strong_string_synthesis ok I just want to make sure I understand how this works. you have N with = fs/fo . fs is sampling rate = 44100Hz Fo is the note you want to play like 440hz then you make an array of N sizes and full it up with random value...
  6. B

    C# Karplus-strong algorithm in c# with Naudio

    Mod note: Added [ code ] tags to the following code. I wrote the karplus-strong algorithm in c# using Naudio. I plays the sound, but it does not stop. It should get to 0 and you should not hear anything. but I code get point where it just repeats the same value over and over. so I when in and...
  7. J

    Check for Isomorphism in Hypergraphs

    Hi, I was trying to check whether two hypergraphs are isomorphic to each other using MATLAB. I did the brute force method by permuting the vertices and check all the permutations one by one. This method is pretty slow. An idea suggested by my friend was to represent the hypergraphs as...
  8. evinda

    MHB What is the time complexity of the binary search algorithm?

    Hello! (Wave) Index BinarySearch(Type A[1...N], Type value, Index low, Index high){ 1. Index mid; 2. if (high<low) 3. return -1 4. mid=low+(high-low)/2; 5. if (A[mid]>value) 6. return BinarySearch(A, value, low,mid-1); 7. else if (A[mid]<value)...
  9. evinda

    MHB Learning to Write a Recursive Algorithm in Pseudocode

    Hi! (Wave) I want to write a recursive algorithm as a pseudocode. How can I define the function? Which has to be its structure?
  10. A

    Nesting Algo: Find Formula for List & Target (520)

    Hey guys, I'm searching a formula for this kind of situation : We have a list of values (33,60,50,15,100) and a target (520). We want to know how many times each value can go in the target (close to) with those specifications : - Maximum 2 different value at the time - Minimum use of...
  11. matineesuxxx

    Runtime of Seemingly Unpredictable Division Algorithm

    Last week on my computer science assignment I had to write a division algorithm using only addition and subtraction to tackle a problem. My first attempt was the simple and naive repeated subtraction, although I quickly discovered it was not nearly efficient enough for how I needed to use it, So...
  12. evinda

    MHB Analyzing Time Complexity and Memory of Binary Search Algorithm

    Hello! (Wave) I want to show that the $T(n)$ of the following algorithm is equal to $O(\log n)$. How can we do it, now that we have if, else conditions? (Thinking) int BinarySearch(int A[1…n], int y, int low, int high) { if (high < low) { return -1; //not found } mid = low + (high -...
  13. S

    0-1 kNapsack problem FPTAS algorithm

    I have the following 0-1 knapsack problem variant: I want to buy X units of a product at min cost, and there are m farmers that offer: - farmer 1: a11 units at cost c11, ..., a1n1 units at cost c1n1 ... - farmer m: am1 units at cost cm1, ..., amnm units at cost cmnm and I can choose at most...
  14. A

    Implementing Shift and Add Algorithm for 3D Reconstruction of X-ray Images

    Problem: In my class, we have been assigned a project where we must implement a shift and add algorithm to a set of xray images. There are 16 xray images of a finger joint taken with a 5 angle increment using a C-arm xray system. The xray images we will be given is from the second citation that...
  15. evinda

    MHB Algorithm with ceil(n/2) comparisons

    Hello! (Wave) I am looking at the following exercise: We say that a sequence of numbers $A=(a_1,a_2, \dots, a_n) , n \geq 3$, is strictly alternating if for each $i$, with $2 \leq i \leq n-1$, one of the following conditions stands: $a_{i-1}< a_i$ and $a_i>a_{i+1}$ $$$$ $a_{i-1}>a_i$ and...
  16. S

    What's a general algorithm to build a supercell from a primitive cell?

    Basically, I've written some code that take as inputs 1)Basis vectors 2)lattice translation vectors and computes the structure factor of the basis, producing a diffraction pattern. I'd like to begin incorporating subtle differences between atoms, so I want to compute the structure factor of...
  17. evinda

    MHB Applying Dijkstra Algorithm: Solving a Problem

    Hello! (Wave) I want to apply the Dijkstra algorithm at an example. Dijkstra(G,s,v) 1. InitialValues(G,s) 2.S<-∅ 3.Q<-V // priority queue,with key the field d[] 4. while Q ≠ ∅ 5. u<-Extraction_of_Minimum(Q) 6. S<-S U {u} 7. for each v ∈ Adj[u] 8...
  18. evinda

    MHB Sentences about the Template algorithm

    Hello! (Wave) Could you explain me some sentences,that are related to the following algorithm? Template algorithm(G) A<-∅ while A isn't a connected tree we define an edge (u,v),that is secure for A A<-A U {(u,v)} return A Let $G=(V,E)$ be an undirected...
  19. evinda

    MHB What is the Template Algorithm for Minimum Spanning Trees?

    Hello! (Wave) According to my notes: Template algorithm The algorithm keeps the invariant : "before each iteration,the set $A$ of vertices is a subset of some minimum spanning trees" at each step,where $A$ is an initial set of vertices. Template algorithm(G) A<-∅ while A isn't a...
  20. G

    Optimization Programming - Which Algorithm?

    Hey guys! I need a little help in continuing my research i did this summer. So a little background information: This summer i conducted research at a REU where i focused on optimizing the power output of a wind farm by modeling wind turbine locations within a constrained space. I wrote a...
  21. S

    Why does this algorithm (about computing a^n) work?

    Homework Statement Here is the algorithm (which works perfectly) for computing a^n for any integer a and a nonnegative integer n in Pascal-style pseudocode.: k := n; b := 1; c:= a; {a^n = b * (c^k)} while k <> 0 do begin if k mod 2 = 0 then begin k := k div 2; c := c...
  22. D

    Euclidean Algorithm Gaussian Integers

    Hi, Just wondering when using the Euclidean Algorithm to find gcd of 4+7i and 1+3i. Where does 2 and 2+i come from in the follwoing? 4+7i = 2*(1+3i)+(2+i) 1+3i=(1+i)*(2+i) +0? I know you didvide them to get (5-i)/2 and then take closest Gaussian integer then not sure where to go.
  23. mesa

    Question about the Borwein fast algorithm for certain values of Gamma

    I am reading through Borwein's paper, "Fast evaluation of the gamma function for small rational fractions using complete elliptic integrals of the first kind" and have a question. If we look at his algorithm's we see they are of this general form...
  24. mesa

    Looking for Borwein's/Zucker's fast algorithm for the gamma function.

    I have heard that the Borwein/Zucker algorithm for computing certain values of the gamma function is pretty awesome, but finding it online is proving elusive... Does anyone know the algorithm?
  25. Greg Bernhardt

    What is the CORDIC Algorithm and How Does it Work?

    [SIZE="4"]Definition/Summary CORDIC (digit-by-digit method, Volder's algorithm) (stands for COordinate Rotation DIgital Computer) is a simple and efficient algorithm to calculate hyperbolic and trigonometric functions. It is commonly used when no hardware multiplier is available as the only...
  26. ShayanJ

    Fast tridiagonal matrix algorithm

    I heard about fast tridiagonal matrix algorithm. I tried to find what is it but I can only find tridiagonal matrix algorithm. How is Fast tridiagonal matrix algorithm different? Thanks
  27. S

    Generate a Formula for Square Spiral Algorithm | 10x10 Problem Statement

    The problem statement Form a formula to generate every value in the 10x10 square spiral shown above. Use the variables: x = the column of the cell, y = the row of the cell, s = the size of the spiral (in this case 10). The formula must work for any size of spiral, where s is the width...
  28. P

    Multiple birth and cut algorithm

    Hi there I have found an algorithm within the literature that is known as multiple birth and cut. It is in a word fantastic! It seems like it has the potential to solve a problem I have been fighting with. I have been tasked with detecting nuclei in histopathology images and so far the...
  29. J

    How Does the Modulus Operator Work in Coin Change Algorithms?

    only had a brief intro to algorithms like this Given an amount of money A between.01 and .99, this determines the breakdown of A into quarters (q) dimes (d) nickels (n) pennies (p) q:=A div 25 A:=A mod 25 d:= A div 10 A:= A mod 10 n:= A div 5 p:= A mod 5 I have to trace the...
  30. N

    Optimal algorithm for scanning servers.

    I'm writing a piece of software and need to find an optimal algorithm for scanning servers. Basically I'm given a list of N IP addresses, each IP address has two associated datetime values: The time the server was last known to be online and the time of the last connection attempt. Given these...
  31. B

    C# Can someone help me fix the loudness issue with my pink noise algorithm?

    Can someone go over the pink noise algorithm for ? I am not really understand how to make pink noise this is what I did : for (int n = 0; n < sampleCount; n++) { Frequency_Start = rnd1.Next(8); Frequency_End = Frequency_Start * 2...
  32. V

    Protein electrophoresis algorithm

    Hello I'm trying to implement a application that will scan the electrophoresis gels and draw a graphic of the proteins: albumin, alpha1, alpha2, beta1, beta2 and gamma. The problem is that the resulted graphic is not as it should be. Albumin percentage is too low and the rest of the proteins...
  33. J

    Algorithm to partition a complex equation into 2 master equations

    My Calculus tool is coming along. The only thing left is to write some it's helper functions, such as the one described below: void CalculusWizard::partitionEquation(const std::string & eq, std::string & eq1, std::string & eq2, CalcWizConsts::eqOps & oper) { /* Given an equation eq, partion...
  34. A

    MATLAB Optimization using genetic algorithm in matlab

    For my B.Eng project, I'm optimizing the thermal efficiency of a boiler using genetic algorithm in MATLAB. I'm finding it very tough to write my fitness function, constraint equations and upload my initial population which is a set of data from my case study plant. for boiler thermal...
  35. M

    Algorithm for assembling quadrilateral mesh in FEM

    Hi all, I have co-ordinates of 4 vertices of quadrilateral for every element in mesh. I assembled such elements by moving single, separate point in whole domain and compared it's coordinate with all vertices of quadrilateral. Above technique work properly, but it required rectangle element...
  36. J

    Java Javascript squareroot algorithm and machine epsilon

    So I made a little application to show the steps of approximating a squareroot using the Babylonian Method: http://jaminweb.com/squarerootCalc.html It's not working all the time. When I do the squareroot of 25 starting with an initial guess of 3.1, it works: Applying...
  37. E

    MHB Constructing a matrix version of the transformation algorithm?

    Algorithms like the transformation algorithm: $(x, y)$ --> $(\frac{x}{k} + p, ay + d)$ are not generally used in mathematics. Instead, we use matrices. Multiplying matrixes: you multiply a row of the first matrix by a column of the second. Use the following example: $ \begin{bmatrix}x & y...
  38. J

    I've reached a dead end in my algorithm

    I'm trying to write a function that takes as parameters two strings, [FONT="Courier New"]textStart and [FONT="Courier New"]textTarget, and prints out the steps necessary to transform transform the first into the second, with the allowed steps being: (1) Add a character somewhere in...
  39. 1

    Can someone explain Euclid's Algorithm to me?

    My book is utterly useless - it vaguely gives me a history behind it, its motivations, and then lists an example in which it precedes to write a bunch of utterly false statements and then just.. spits out the answer. Can someone explain to me what on Earth is going on in the attached picture...
  40. chimath35

    Division Algorithm: Understand Unique c & d

    So, the division algorithm states that if a and b are integers with a>0 then there exist c and d integers such that 0<=d<a b=ac+d d and c are unique Now I don't understand d and c being unique. For example 4*3 + 3 = 15 where a=4 c=3 d=3 b=15 c and d are not unique, or maybe I don't...
  41. R

    Solving Algorithm Homework: PrintSpaces(j+1) Error?

    Homework Statement In the given picture below The Attempt at a Solution Im stuck after the begin How can I carry out the printSpaces(j+1) if the value of j wasn't given? Is there an error in the question or is there something that I am not seeing :/
  42. 5

    Algorithm for fibonacci sequence

    Homework Statement create an algorithm for a Fibonacci sequence that will return the f value in f(n) = f(n-1)+f(n-2) Homework Equations f(n) = f(n-1)+f(n-2) The Attempt at a Solution I have tried several ways to create an algorithm that will sum the two previous numbers but always end up...
  43. P

    Can we view the hanoi tower algorithm as the following way?

    the well known hanoi tower algorithm is as follow: public static void hanoi(int n,int a,int b,int c) ( if(n>0) ( hanoi(n-1,a,c,b); move(a,b); hanoi(n-1,c,b,a); ) ) my problem is : can we handle this algorithm in this method? we can regard three places as one place...
  44. J

    Need help designing an algorithm for similarities between words

    For fun, I'm trying to make a C++ program that takes a word from the user and comes up with an ordered list of suggested words, similar to the kind of thing you have on your cell phone when sending SMS messages. So far I have: An [FONT="Courier New"]std::vector<std::string> of the 5000...
  45. A

    Comp Sci C++ Character Processing Algorithm

    Homework Statement Hey guys! Thanks for taking the time to help me out, I really appreciate it. I am in my second semester of college, taking my first C++ course, and I had never programmed before this class so I am kind of stuck on a problem. I have almost the entire assignment figured out...
  46. O

    Labeling Algorithms in LaTeX Thesis: Figures or Algorithms?

    I am using latex for my thesis. Should I label my algorithms as figures, or algorithms? If algorithms, how do I reference them in the text? For figures I say, (Fig. 1). For algorithms? (Algo. 1), (Algorithm 1)? Thanks
  47. esis

    MHB Algorithm for finding all the borders of R in all dimensions?

    Hey Guys! To begin with, I apologize if I am using the wrong terminology. I've just begun learning about linear algebra. So I was working on a problem in the book "Introduction to Linear Algebra" by Gilbert Strang, fourth edition (problems 9 and 11 on p. 8). Problem 9: If three corners of a...
  48. N

    Algorithm for Generating Percentage Amounts

    Hey guys, Not totally sure this thread belongs in this section, feel free to move. I'm trying to formulate an algorithm for an unusual problem. - Generate a pie chart with X number of wedges. - Each wedge is X percentage bigger then the one before it. - Percentage amounts of all...
  49. T

    SVD Low-Rank Approximation Algorithm

    I'm looking for a concise description of an algorithm for low-rank approximation via SVD. I've seen a number of articles referring to Lanczos method and finding eigenvalues but nothing going all the way to determining all the matrices involved in the low-rank SVD of a given matrix. Any...
Back
Top