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.

learn more… | top users | synonyms (1)

0
votes
1answer
177 views

Should an algorithm handle invalid inputs and can it have hard-coded paths for certain input data? [duplicate]

I have certain preconditions on input data and I need to design an algorithm for that data. Should I also handle invalid preconditions? Also is it normal that my algorithm will work only for a ...
0
votes
4answers
143 views

Big-O of this algorithm?

How can I describe the growth function in terms of n for the following algorithm? What is the bounding function (the Big-O)? Is it O(n^3)? for(i = 0 to n - 1) { c = i + 1 for(j = c to n) ...
14
votes
10answers
1k views

Find out whose turn it is to buy the croissants, accounting for possible absences

A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The ...
5
votes
3answers
1k views

random unique pair numbers from two range

I want to write a function that return random unique pair numbers every time call it from a range until resetting it. Something like this: function randomUniquePairs($ranges, $reset = false){ if ...
0
votes
0answers
100 views

Algorithm to analyse and predict

I'm having a set of data's, say Question, Question's Main Category,Main Category followers, Question's Related Categories,Each Related Categories followers, Whether it got answer in 24hrs [Yes/No] ...
0
votes
0answers
182 views

Performance of a Skip-List algorithm

Here is a simple code for a randomized skip-list: Coin_Side flip() { if ( random() % 2 == 0 ) return HEADS; else return TAILS; } Note: random() returns an integer that uses ...
0
votes
0answers
85 views

data stored in dbase (application result dd.mm.yyyy)

I have a .dbf file (dbase) with data of type "date" to read directly via php. I have the application result (format: dd.mm.yyyy) and the stored hex code. I can't interpret the hex data to get the same ...
-2
votes
2answers
456 views

Common and frequently used algorithms of Data structures? [closed]

I have been programming for a while, and the edge that I am missing over other programming is algorithms. I know what is linked-list and binary tree, but I dont know many more of them. I failed on 2 ...
3
votes
1answer
194 views

Processing every leaf under a node in a tree efficiently

Short version: In a tree (non-binary) with many levels of children, where each node can have multiple leaves, what is the best way to tally leaves that meet a certain condition given a node? Long, ...
0
votes
2answers
425 views

How do you come up with algorithms?

I picked up some Project Euler questions today and decided to find more effective ways to Answer the questions l had already answered. So on the question about finding the sum of the even Fibonacci ...
5
votes
1answer
207 views

Bin sorting problem - Please help categorize

I have a problem I am developing a solution for and currently I solve it with a brute force solution that checks all possibilities. It works for small numbers of bins but I'd like to work with a ...
4
votes
2answers
312 views

Do Tech Firms use a lot of Algorithmic Practices that we studied in college? [closed]

I am yet to start my career, I have a profound interest in algorithm design. I somehow fail to understand that, how would a tech firm use the algorithmic paradigm? I mean in real life projects do we ...
18
votes
2answers
957 views

What class of problem is this, and what math do I need to know to solve it?

Mushroom cultivation requires fairly precise chemical composition of substrate (a.k.a. growing medium). Let's pretend we're growing shitakes and that this is the required composition of their ...
6
votes
6answers
4k views

Why is binary search,which needs sorted data, considered better than linear search?

I have always heard that linear search is a naive approach and binary search is better than it in performance due to better asymptotic complexity. But I never understood why is it better than linear ...
2
votes
2answers
654 views

Optimize Reading of Multiple files

I have a unique problem which I'm hoping someone can assist with. I have One big text file, our Production file. The data in the file is delimited in the following format Reference|Cost ...
3
votes
2answers
598 views

Text search - big data problem

I have a problem I was hoping I could get some advice on! I have a LOT of text as input (about 20GB worth, not MASSIVE but big enough). This is just free text, unstructured. I have a 'category ...
1
vote
2answers
90 views

Fair 2-combinations

I need to fairly assign 2 experts from x experts (x is rather small - less than 50) for every n applications, so that: each expert has the same number of applications (+-1); each pair of experts ...
5
votes
4answers
647 views

How to familiarize myself with Python

I'm a Python beginner. I started programming with Python 1.5 months back. I downloaded the Python docs and read some parts of the tutorial. I have been programming on codechef.com and solving ...
1
vote
1answer
161 views

What is the name of this array transformation?

Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be. [[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]] At the ...
0
votes
3answers
163 views

Suggestion for a Non-CSE developer [closed]

Due to financial problems, I couldn't go for CSE in my country and had to settle for a BCIS honors degree. Now, after quite some time, when I want to go for a higher position in software development ...
-1
votes
3answers
191 views

programming practices starting [closed]

I have taken my major as computer science and Engineering and I am really confused at this moment. My first course was about learning C and C++ and I learned the basics of those. Now I am really ...
-1
votes
2answers
2k views

What do I need to know about Data Structures and Algorithms in the “real” world [closed]

I just finished the data structures and algorithms course in school , I took it during the summer so 6wks course vs a 16 wk course during the regular semester. So not only was the course hard but it ...
6
votes
3answers
1k views

Why is Quicksort called “Quicksort”?

The point of this question is not to debate the merits of this over any other sorting algorithm - certainly there are many other questions that do this. This question is about the name. Why is ...
5
votes
2answers
350 views

Structuring Access Control In Hierarchical Object Graph

I have a Folder entity that can be Moderated by users. Folders can contain other folders. So I may have a structure like this: Folder 1 Folder 2 Folder 3 Folder 4 I have to ...
4
votes
1answer
763 views

Randomization of biomes

You know how in Minecraft, the World is ever-expanding and all the biomes are randomized? My generalized question is: In relation to a space simulation that is also ever-expanding as the player moves ...
0
votes
4answers
298 views

How to manually detect deadlocks

I understand the concepts of deadlock well enough, but when I'm given a problem like the one below I'm not sure how to go about solving it. I can draw a resource allocation graph, but I'm not sure how ...
1
vote
2answers
984 views

Finding duplicate files? [duplicate]

I am going to be developing a program that detects duplicate files and I was wondering what the best/fastest method would be to do this? I am more interested in what the best hash algorithm would be ...
1
vote
1answer
105 views

How to compute a signature of a matrix

We know some signature/checksum methods for text, like md5,sha. Now, I want to compute a checksum for a matrix, to represent the exact matrix. Say, two matrixes with different sizes, or with ...
-1
votes
2answers
76 views

Store a tree with near next neighbours

I would to find an efficient structure (speed and volume) to store nodes and their neighbourhood. My input is build out of stings in the following format ./X/Y.log where X ∈ [0,359] and Y ...
-1
votes
2answers
262 views

Just in time prize winning algorithm [closed]

I'm building a contest where you can win prizes by opening boxes. Whatever the box is open, i just send a request to the server to test if the user won something. Since this contest is not a "Register ...
0
votes
0answers
173 views

Development of algorithmical concept for scheduling and allocation problem

I have to solve a problem in the field of operations research. I want to gather some general approaches to evaluate them to pick the most promising to design a problem-related program. Problem ...
1
vote
0answers
156 views

Algorithm for generating hyperexponential distribution

I need to generate a hyperexponential distribution for my project. I have already implemented a poisson generating algorithm given by Donald Knuth, but I couldn't find an algorithm for generating a ...
2
votes
1answer
201 views

Algorithm in undirected BFS graph

I'm trying to put together an algorithm that will display the node degree for every node in a breadth first tree graph (assume BFS was called). Assume it's an undirected graph. I'm not sure how to ...
0
votes
1answer
265 views

How can I reduce my problem into Max flow problem?

I am trying to reduce my problem to a max flow problem so I can run the max flow algorithm on this problem. But there are some things that I am missing while transforming my problem. My problem is: ...
4
votes
2answers
98 views

Placing elements in graph with a streaming/online algorthm

We have a stream of points with about 1000 points per second. For each point, we have a complex vector (hundreds of dimensions). Our goal, for each point is to link it to the 5 closest points that ...
0
votes
1answer
139 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 ...
8
votes
3answers
499 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 ...
5
votes
1answer
625 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 ...
2
votes
1answer
253 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 ...
1
vote
2answers
891 views

Radix exchange sort implementation?

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, ...
6
votes
3answers
247 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 - ...
1
vote
1answer
247 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 ...
11
votes
1answer
579 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(n^3) to O(n^2.8). But of all the resources I have gone through, ...
4
votes
4answers
625 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 ...
3
votes
1answer
227 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 ...
7
votes
3answers
369 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.
0
votes
0answers
153 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 ...
0
votes
0answers
73 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 ...
3
votes
1answer
230 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 ...
1
vote
1answer
869 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 ...