# Tagged Questions

In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning.

151 views

### Does the ray tracing algorithm involves rasterization of image?

I am constructing a ray tracing algorithm , i know that the first step is to develop camera and view plane specifications. Now is the next step performing rasterization algorithm on image before a BVH ...
663 views

### What the correct algorithm to invert italics in a mixed text?

The question motivations was depicted in the section below. There are many ways to make text italic, so, perhaps, there are more than one good "swap italics algorithm". The problem reveals some ...
2k views

### Where to learn graph theory applications [closed]

I am completely new to designing algorithms with graphs. I am following CLRS and other video lectures in Youtube, notably from IIT/MIT. They are pretty good, and I currently have decent idea about ...
303 views

### Which algorithms typify Lisp's power? [closed]

Similar question here (but not the same) because I am interested in which specific algorithms work particularly well in Lisp. Lisp tutorials always give the example of finding factorials, but wanting ...
2k views

I need a little help understanding the implementation of radix exchange sort algorithm. Radix exchange (I don't know if it's the exact name in english based literature) is a lot similar to quicksort, ...
256 views

### How can degree of order in a list be measured?

The following questions gave me food for thought: Efficient way to shuffle objects I'd like to write an "ultimate shuffle" algorithm to sort my mp3 collection When you sort a list - ...
377 views

### Is there a time bomb in sequential process id allocation when the `unsigned` wraps?

I'm designing and implementing a multiprocessing postscript interpreter ("lightweight" processes simulated by a single OS-thread), and I need to generate a unique identifier for each process in the ...
1k views

### How did Strassen come up with his matrix multiplication method?

The famous Strassen's matrix multiplication algorithm is a real treat for us, as it reduces the time complexity from the traditional O(n3) to O(n2.8). But of all the resources I have gone through, ...
1k views

### How to rotate an array of bits

I currently have a PIL Image object which I store as an array of bits (1's and 0's). However I now would like to be able to rotate that image 45 degrees. One way to do it is take the original PIL ...
268 views

### Finding maximum number of congruent numbers

Let's say we have a multiset (set with possible duplicates) of integers. We would like to find the size of the largest subset of the multiset such that all numbers in the subset are congruent to each ...
401 views

### Change of the complexity class through compiler optimization?

I am looking for an example where an algorithm is apparently changing its complexity class due to compiler and/or processor optimization strategies.
173 views

### Algorithm to find last allocated job for each worker

Let's say we have n jobs numbered from 1 upto n and k workers numbered from 1 upto k. All the jobs are equally difficult, but some workers are more efficient than others, so we are given the time it ...
82 views

### Efficient Copy While Sorting

I have an algorithms library called NDex. I am in the process of upgrading it to a new version. Part of this upgrade involves providing two versions of many algorithms: an in-place version and a ...
390 views

### Algorithm, AI, or intelligent agent suggestions for ingesting poorly-formatted & variable data from different document types

Thanks for looking! Background I have been tasked with writing a program to normalize and ingest data from various sources to a common database. For the sake of simplicity, let's say that the ...
1k views

### Matrix Pattern Recognition Algorithm for a 2D space

I have a picture that I elaborate with my program to obtain a list of coordinates. There is a matrix represented in the image. In an ideal test I would get only the sixteen central points of each ...
152 views

### Algorithm for Cyclical Sequence Alignment

Let's say we have 3 cyclic sequences, each of them of length n and containing every number from the interval 1..n once. The goal is to align the sequences in order to maximize the number of matches ...
755 views

### Find the count of each word in a string

I am in a search of a better performant algorithm to implement a program, to find the count of each word in a sentence i.e.., a String in the programming sense. I know my algorithm is too basic and ...
2k views

### simple 'defrag' logic that minimizes changes?

edit: so clearly I didn't explain this well, so let me try again with examples. I have a 'pipe' of a given size with signals routed through it at given offsets. The pipe can get fragmented with ...
2k views

### What algorithms are there for picking colors for plot lines on graphs?

I'm interested in what algorithms or rules I can programmatically implement to generate RGB or HSV colors for plotlines to keep them visually distinct from the neighbors. I know that in professional ...
8k views

### How does Jump Point Search algorithm work and why is it so efficient?

While trying out the below applet, I saw that this path finding algorithm called Jump Point Search yields significantly faster result than A* and Dijkstra. http://qiao.github.io/PathFinding.js/visual/...
280 views

### Optimization algorithm, how to develop this problem

I have a situation where I would like your input and think over / solve algorithm. The specs There are inventories with a specified amount of capacity. 'X (width) and Y (time)' creates ...
77 views

### Defining a status between last check and now

I have sets of probing data from an internal monitoring tool which represent the availability of different services (databases, webservices and so on). Now my task is to visualize this data and I ...
426 views

### Suitable algorithm for joining records from multiple databases

I am in the process of writing a library that is used to be able to access data from a database. The library requires the initial definition of all the tables that the application will be using in the ...
912 views

### Find the peak of each islands in sparse matrix

I have a sparse matrix that contains several islands of unknown size. I would like to find the highest peak of each islands. Consider this matrix as an example: 0 0 1 0 0 0 0 0 0 1 2 1 0 0 0 0 0 3 2 ...
6k views

### What is the time complexity of the algorithm to check if a number is prime?

What is the time complexity of the algorithm to check if a number is prime? This is the algorithm : bool isPrime (int number) { if (number < 2) return false; if (number == 2) return ...
702 views

### Priority queue for Kruskal's algorithm with running time O(E lg V)

I'm reviewing my notes on Kruskal's algorithm and have a question about getting the runtime down to O(E lg V). By using a PQ with edges and a boolean array of which vertices we have added to our tree ...
675 views

### What data structure is suitable for implementing dynamic huffman encoding and decoding on a piece of text?

Some pseudo code or resources will be appreciated.I was thinking if implementing it in form of a BST stored in an array. However,not all operations can be performed easily using this approach. I am ...
5k views

### Divide and Conquer algorithms – Why not split in more parts than two?

In divide and conquer algorithms such as quicksort and mergesort, the input is usually (at least in introductory texts) split in two, and the two smaller data sets are then dealt with recursively. It ...
270 views

### Why are there non-decidable languages? Can anyone explain me my book's solution?

Well in my book it is says that "there are non-decidable languages" And the proof is: Every algorithm is a word. Then there are only countable algorithms. But there are uncountable languages and ...
253 views

### Given a situation, and some conditions, verify is that situation is possible

Well it's a problem me and my friend had thought of, and well, haven't come up with anything to solve the following problem(I'll try to phrase it in the best way I can): Given that there are n ...
7k views

### Retrieving maximum value from a range in unsorted array

I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned. For example: array[]={23,17,9,45,78,2,4,6,90,1}; query(both inclusive): 2 ...
3k views

### How can you prove an acyclic graph has n-1 edges? [closed]

I'm not so hot on the maths for this but for what I understand... A graph g exists with v vertices and edges. g = (V,E); The spanning graph for this is an acyclic copy of this where all the vertices ...
142 views

### Matching two lists of data with different conventions

I have two lists of data, A and B. These lists are themselves aggregated from multiple sources, and contain typos, abbreviations not found in the other, and also lack a 1-1 mapping, but will never ...
10k views

### Quicksort and middle pivot

I am having a head ache understanding quicksort with middle pivot. I found lot of explanations about using left most or right most, but not many about a middle one. Can I safely assume these?: If ...
165 views

### Algorithm/Strategy or Data structure to capture priorities sub priorities in an app

I am working on a CMS that is starting to evolve a bit. We started off with content that had the following priorities ( columnn in the db on the content table): HIGH MED LOW. Data was fetched by ...
189 views

### What kind of algorithm could be used to produce an ordering which maximizes # of satisfied 'less than' constraints?

Let's say I have a set of items {e1, e2, ..., en}, and I also have a set of constraints {c1, c2, ..., cm}, with ci := ej appears before ek, for some j and k. I want to produce an ordering of my items ...
466 views

### Can an 81 digit number generator lead to copyright infringement? [closed]

I'm looking to write a program that will generate valid sudoku puzzles. Essentially, a sudoku puzzle is just an 81 digit number. (The blanks are zeroes.) I would then like to use these puzzles in an ...
906 views

### Transform math formula into code (line-line intersection)

I'm having hard times transforming a math formula to code. I can solve it on the paper easily, but it's hard for me to bring it into code form. Is it generally possible to bring a math formula ...
7k views

### Is the algorithm more important than the programming language?

During the current (2013) Google Code Jam contest, there was a problem that took C++ and Java people 200+ lines of code as compared to Python people that solved the same problem only using 40 lines of ...
989 views

### Puzzle solving: Minimum number of steps to achieve a goal

I have been doing some programming contest problems, and I have noticed that many of them involve something along the lines of "get the minimum number of steps necessary to achieve a certain goal". ...
416 views

### Approach to simplifying an algorithm

For completely random reasons*, I wrote some code that calculates and displays the following expression: P=1*(2+2)(3+3+3)(4+4+4+4)..(n+n...… Which is equivalent to (n!)^2 The version I wrote (...
6k views

### Generating random math expression

I have this idea running around in my head, to generate and evaluate random mathematical expressions. So, I decided to give it a shot and elaborate an algorithm, before coding it to test it. Example: ...
750 views

### What is the best programming language to do crypto running time measurement? [closed]

I am trying to measure the running time of different crypto algorithm. e.g. how long it takes to encrypt/decrypt a block of plaintext. May I ask if C with OpenSSL is the best PL to do this?
303 views

### Creating alien symbols or signs that look natural [closed]

I was reading some Cthulhu Mythos stuff and started to think about those various signs and symbols that are used in the texts. Of course those are made by humans but point is that they look natural to ...
228 views

### How can I compute maximal area including only given integer pairs of (x,y) coordinates?

The values ​​of a function of two variables z = f (x, y), where x, y, z take integer values are stored in sql db. Calculate (appoint) the largest surface area of ​​the flat. By 'flat area' we mean an ...
437 views

### Does any know of a Algorithm that allows for a figure like this image?

Does anyone know how to create an algorithm capable of making the figure just like in the picture, when given a set of specific points (3D array)
486 views

### Can we create a program that writes out its source code?

Can we create a program that print out its source code what if we (or the program itself) compile than the new program would have the same exact functionality what the original program has? So somehow ...
2k views

### What does it mean to perform an operation “In Place” for Interpreted Languages?

Programming question: Reverse words in a string (words are separated by one or more spaces). Now do it in-place. What does "in-place" mean in the above context for an interpreted language ...