Algorithm Definition and 724 Threads

  1. G

    Algorithm for Numerical approximation to add data points

    Hi, I am working on TDR (Time Domain Reflectometry). I send a 7GHz bandwidth fast rising edge (14ns) square wave into a coax. I get a return Signal. I have an ADC with 10Msamples/sec. I am using MPLAB IDE for coding the microcontroller. Now I would like to increase the Points on the...
  2. S

    MHB Linear programming problem (simplex algorithm)

    Can anyone help me to solve that problem ? I would really appreciate For the linear programming problem P1 : Max z = 2 + x1 - 2x4 x2 = 1 - x4 x3 = 0 - x1 - x4 xi \ge 0 1 \le i \le 4 Question 1 : Explain why the writing of that linear programming in the form proposed above...
  3. G

    High Frequency signal with fast risetime, its bandwidth

    Hi, I am new to world of electronics and to high frequency Domain. But I am working on a design where I have a coax of 30cm length. I have used an external oscillator to generate 7GHz fast falling pulse. I am using a Controller to control the oscillator. Now I have a pulse of about 350ns...
  4. ognik

    MHB Newton-Raphson algorithm for the root of tanh

    The N-R (iterative) formula is: xi+1=xi - f(xi) / f '(xi). A textbook exercise states that the N-R method does not converge for an initial guess of x >~ 1. I wrote the required program for tanh and found the method diverges at x >~ 1.0886. But I don't understand why it is this value - the N-R...
  5. Superposed_Cat

    Genetic algorithm, Which Chromosomes to crossover given fitness?

    Hi all, I'm busy writing my first genetic algorithm. A simple one that finds an expression to give a desired number, ie you'll give it the number 40 and it will give you 5*7+5. I have the fitness function, the parser that uses the string to compute the number and the crossover system, so only...
  6. G

    PID algorithm for constant temperature controller.

    Hello. I`m looking for help to write the coorect PID algorithm for heating controller. For start in attachment I`m sending You the graph. If someone of You can help I could send some more informations.Greg.
  7. J

    Find First Place Where F <= 0 in O(log n) Time

    Homework Statement Consider a strictly decreasing function F: ℕ → ℤ. We want to find the "first place where f is at or below the horizontal axis." Assume we can compute ƒ(i) for any input i in constant time. Clearly, we can solve the problem in O(n) time by evaluating ƒ(1), ƒ(2), ƒ(3)...
  8. evinda

    MHB Algorithm for Ordering Odds & Evens in Linked List L

    Hello! (Wave) Consider a singly-linked list L each element of which is a struct with two fields, an integer num and a pointer next to the next element of the list. Describe an algorithm that gets as argument a pointer to the first element of the list L and that creates a new list L' that...
  9. evinda

    MHB Show that the Dijkstra's algorithm computes correctly the shortest paths

    Hello! (Smile) Suppose that we are given a weighted, directed graph $G=(V,E)$ at which the edges that begin from the initial node s could also have negative weights, but the weights of all the ther edges are non-negative and there are no cycles of negative weight. Show that the Dijkstra's...
  10. evinda

    MHB Dijkstra's Algorithm Exercise: Find the Solution!

    Hi! (Smile) Could you give me a difficult exercise that is related to the Dijkstra's algorithm? (Blush)
  11. evinda

    MHB Heapifying a Min-Heap: Examining My Algorithm

    Hello! (Wave) I tried to write an algorithm that heapifies a min-heap.. That's what I have tried: MIN_HEAPIFY(A,i){ left=2*i; right=2*i+1; smallest=i; if (left<=length(A) and A[left]<A[smallest]) smallest=left; if (right<=length(A) and A[right]<A[smallest]) smallest=right; if...
  12. PsychonautQQ

    Number Theory Division Algorithm interesting problem

    Homework Statement Not actually for homework, but i didn't know where to post this. Problem: Show that any integer to the fourth power can be expressed as either 5k or 5k+1 where k is an integer. Homework Equations None. The Attempt at a Solution My starting point is to consider that all...
  13. QPingy

    Numerical integration - verlet algorithm - accuracy

    In my computational physics textbook, three different velocity estimators are derived for a problem with equation of motion: \ddot x = F(x) where the positions are found by using the Verlet algorithm: x(t+h) = 2 x(t) - x(t-h) + h^2 F[x(t)] The three velocity estimators are: v(t) = \frac{x(t+h)...
  14. 22990atinesh

    How to find min and max of 100 numbers ?

    Homework Statement The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is ... Homework Equations ##T(n)=T(\lceil \frac{n}{2} \rceil) + T(\lfloor \frac{n}{2} \rfloor) + 2## The Attempt at a Solution Recurrence for the above problem is ##T(n)=T(\lceil...
  15. Henry R

    MHB Selection Sort & Insertion Sort: Step-by-Step Guide to Sorting Data

    How to do this? Show the step by step how the following data is sorted into ascending order using the given sorting algorithm : 22 85 43 28 65 35 i) Selection sort. ii) Insertion Sort.
  16. nomadreid

    Dijkstra's algorithm: choosing which point to begin with

    In Dijkstra's algorithm (for an efficient way to find the shortest path between two given vertices, or nodes, in a graph), the only freedom the programmer has is to name which of the two given vertices one begins with. Is there any efficient way to tell which one of the two one should start...
  17. M

    MHB Worst-case running time of algorithm

    Hey! :o Let the quicksort algorithm be the following: procedure QUICKSORT(S) if S contains at no one element then return S else begin choose an element a randomly from S; let S1, S2 and S3 be the sequences of elements in S less than...
  18. evinda

    MHB Algorithm with time complexity o(n^2)

    Hi! (Smile) I am looking at the following exercise: Let $M=\{ y_1, y_2, \dots, y_n \}$ a set of real numbers, where $n \geq 2$. Describe an algorithm, that has time complexity $o(n^2)$ and that finds and returns two elements $y_k$ and $y_l$ of $M$, such that: $$|y_k-y_l|=\min_{1 \leq i,j \leq...
  19. evinda

    MHB This is the algorithm of Quicksort

    Hi! (Nerd) This is the algorithm of Quicksort , according to my notes: Quicksort(A,p,r) if (p>=r) return; q=Partition(A,p,r); swap(A[q],A[r]); Quicksort(A,p,q-1); Quicksort(A,q+1,r) Partition(A,p,r) x=A[r]; i=p-1; for (j=p; j<r; j++){ if (A[j]<=x){...
  20. evinda

    MHB Proving Correctness of Heap Building Algorithm

    Hello! (Nerd) We are given the following algorithm: 1.BUILDHEAP(A) 2. for (i=floor(size(A))/2; i>=0; i--) 3. HEAPIFY(A,i); according to my notes, we could prove its correctness, proving the following sentence: At the beginning of each iteration of the for loop at the lines...
  21. evinda

    MHB Creating a Loop Version of HEAPIFY Algorithm

    Hi! (Wave) Given the following algorithm: HEAPIFY(A,i) l=LEFT(i); r=RIGHT(i) largest=i; if (l<=size(A) && A[l]>A[largest]) largest=l; if (r<=size(A) && A[r]>A[largest]) largest=r; if (largest!=i) swap(A[i], A[largest]) HEAPIFY(A,largest) I want to...
  22. evinda

    MHB What is the purpose of the MERGESORT algorithm?

    Hello! (Mmm) I am looking at the following algorithm: MERGESORT(A,l,r){ if (R==L) return; MERGESORT(A,l,floor((r+l)/2)); MERGESORT(A,floor((r+l)/2)+1,r); return MERGE(A,l,r,floor((r+l)/2)); What does the above algorithm do? Could you explain it to me? (Thinking)
  23. 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)...
  24. 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...
  25. 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)
  26. 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)
  27. 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...
  28. 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...
  29. 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...
  30. 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)...
  31. 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?
  32. 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...
  33. 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...
  34. 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 -...
  35. 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...
  36. 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...
  37. 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...
  38. 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...
  39. 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...
  40. 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...
  41. evinda

    MHB Exploring Template Algorithm & Min 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...
  42. 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...
  43. 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...
  44. evinda

    MHB Explaining the Cost of Quicksort Algorithm

    Hello! (Wave) I am looking at the algorithm of the Quicksort: Quicksort(A,p,r) if p<r then q<-partition(A,p,r) Quicksort(A,p,q-1) Quicksort(A,q+1,r) According to my notes,the cost is: $T(n)=T(q)+T(n-q)+(\text{ cost of...
  45. 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.
  46. 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...
  47. 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?
  48. Greg Bernhardt

    Exploring CORDIC Algorithm: Digit-by-Digit Method & Volder's Algorithm

    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 operations...
  49. 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
  50. 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...
Back
Top