# 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.

784 views

### Would a professional, self taught programmer benefit from reading an algorithms book? [closed]

I'm a 100% self taught, professional programmer (I've worked at a few web startups and made a few independent games). I've read quite a few of the "essential" books (Clean Code, The Pragmatic ...
2k views

### Analyzing Memory Usage: Java vs C++ Negligible?

How does the memory usage of an integer object written in Java compare\contrast with the memory usage of a integer object written in C++? Is the difference negligible? No difference? A big difference? ...
211 views

### Fast programmatic compare of “timetable” data

Consider train timetable data, where each service (or "run") has a data structure as such: public class TimeTable { public int Id {get;set;} public List<Run> Runs {get;set;} } public ...
205 views

### Defining formula through user interface in user form [closed]

I am a student and developing a simple assignment - windows form application in visual studio 2010. The application is suppose to construct formulas as per user requirement. The process: It has to ...
211 views

### What is an efficient algorithm for randomly assigning a pool of objects to a parent using specific rules

I need some expert answers to help me determine the most efficient algorithm in this scenario. Consider the following data structures: type B { A parent; } type A { set<B> children; ...
734 views

### Algorithm to calculate trajectories from vector field

I have a two-dimensional vector field, i.e., for each point (x, y) I have a vector (u, v), whereas u and v are functions of x and y. This vector field canonically defines a set of trajectories, i.e. ...
881 views

### Order of learning sort algorithms

I have already studied bubblesort, insertion sort and selection sort and can implement them in C pretty much from knowledge of the algorithm. I want to go on to learn shellsort, merge sort, heapsort ...
755 views

### What are the most known arbitrary precision arithmetic implementation approaches?

I'm going to write a class library for .NET which provide an implementation of arbitrary precision arithmetic for integer, rational and maybe complex numbers. What best known approaches should I ...
2k views

### Improving grepping over a huge file performance

I have FILE_A which has over 300K lines and FILE_B which has over 30M lines. I created a bash script that greps each line in FILE_A over in FILE_B and writes the result of the grep to a new file. ...
194 views

### What is an appropriate language for expressing initial stages of algorithm refinement?

First, this is not a homework assignment, but you can treat it as such ;). I found the following question in the published paper The Camel Has Two Humps. I was not a CS major going to college (I ...
89 views

### Figuring a max repetitive sub-tree in an object tree

I am trying to solve a problem of finding a max repetitive sub-tree in an object tree. By the object tree I mean a tree where each leaf and node has a name. Each leaf has a type and a value of that ...
768 views

Consider the following exam / interview question: Implement the strcpy() function in C: void strcpy(char *destination, char *source); The strcpy function copies the C string pointed by source into ...
1k views

### Algorithm development in jobs

I have a mathematics background but also consider career in some form of software development. In particular I'm interested in finding out what sort of industries are most likely to have more ...
237 views

### Algorithmic problem - quickly finding all #'s where value %x is some given value

Problem I'm trying to solve, apologies in advance for the length: Given a large number of stored records, each with a unique (String) field S. I'd like to be able to find through an indexed query ...
874 views

### Learning basic algorithms - better C or C++? [closed]

I'm studying fundamental algorithms (quicksort, mergesort, binary trees, etc..) and I'm going to re-code every algorithm by scratch to learn how they work. Should I code them in C or C++? I think with ...
9k views

### I'm a CS student, and honestly, I don't understand Knuth's books

I stumbled upon this quote from Bill Gates: "You should definitely send me a resume if you can read the whole thing." He was talking about The Art of Programming books. So I was pretty curious and ...
285 views

### Relative Scoring system - How to solve this?

I am trying to assign scores to phone's specifications to calculate a final rating score for each phone. However, when I was scoring based on megapixels, I found that one of the phones 'A' has a ...
618 views

### How does a garbage collector prevent the whole memory from being scanned on every collect?

Some (at least Mono's and .NET's) garbage collectors have a short term memory area which they scan often, and a secondary memory area which they scan less often. Mono calls this a nursery. To find ...
438 views

### Algorithm for appointment reminders

My program allows users to store appointments in a calendar. What has been requested of me is the ability for SMS reminders to be sent to people to remind them of their appointment. The SMS would ...
1k views

### Initialize array in amortized constant time — what is this trick called?

There is this data structure that trades performance of array access against the need to iterate over it when clearing it. You keep a generation counter with each entry, and also a global generation ...
421 views

### Comparison of my own Insertion Sort versus the standard algorithm

I come from a background of making MVC websites and HTML5 applications, and have recently decided to dive into the sort of stuff i wasn't taught at university, namely the things most people would ...
375 views

### Robot arm sample problem in Skiena's “Algorithm Design Manual” seems to be invalid to me

I'm reading Skiena's Algorithm Design Manual and there is a problem on page 5, "Robot Tour Optimisation", where he says this about the sample problem: "Suppose we are given a robot arm equipped with a ...
342 views

### Is there any better approach to shortest path finding within a (vehicular) traffic network?

Dear fellow programmers, We're developing software which simulates vehicular traffic. Part of the process called "assignment" is concerned with assigning vehicles to their routes and has to use some ...
1k views

### Are all programming problems algorithm problems?

I like how "Introduction to Algorithms" by Cormen et al. conveys knowledge. One reason is that everything has to do with programming problems and the book is not implemented in any particular ...
656 views

### Efficient algorithm to sort html list of players

We have list of players, which is represented in form like this: <div class="players_list"> <div class="player" data-points="500"> <div class="name">Player1</div> ...
1k views

### What do you consider to be the essential design patterns? And do you use them? [closed]

It seems to me that programmers have an increasingly uphill task of staying up-to-date. In my efforts to improve my programming ability, I am in search of the essential design patterns that are ...
234 views

### Dealing with units in arithmetic operations (multiplication and division)

I need to design a function to perform the basic arithmetic operations that are addition (+), subtraction (-), multiplication (x), and division (/) between 2 numbers. That function takes 3 arguments: ...
465 views

### How can I teach my 12 years old brother how program? [duplicate]

Possible Duplicate: What are some good tools for introducing kids to programming? Explaining programming to a child I have a 12 years old brother whom asks me how he can build a website, ...
1k views

### Amortized Analysis? (Worst-case Performance Guarantees)

What is Amortized Analysis? And how can it help me achieve worst-case performance guarantees in my programs? I was reading that the following techniques can help the programmer achieve Worst-case ...
271 views

### Is there an specific way or algorithm to decode protocols?

I am designing a simple logic analyzer, I know that the best way to decode a protocol like I2C, SPI, UART is whit something like an FPGA but I want to do it by software by now :) I am running on an ...
523 views

### Caching's Effect on Program Performance

How does caching effect the performance of a running program? From my understanding, the assumption that each instruction always takes the same amount of time is not always correct, because of the ...
2k views

### AVL Trees and the REAL world

in school we are taught how we can balance an AVL tree upon an insertion or deleting. How is this type of knowledge actually going to be useful in the real world? Can someone give an example on when ...
311 views

### Algorithm Analysis: Frequencies of Execution

I am currently reading the Analysis of Algorithms section in Algorithms, 4th Edition and I'm trying to understand how the author calculated (N^2)/2 and (N^3)/6 frequencies of execution in the code ...
522 views

### Fractional and Cartesian Coordinates

I have a set of fractional coordinates. I also have a rotation matrix that operates on cartesian coordinates. Does anyone know how I could convert my rotation matrix so I can operate on the ...
127 views

### Running time insensitive to input?

I read the following in Algorithms 4th Edition by Robert Sedgewick and Kevin Wayne: Our first qualitative observation about most programs is that there is a problem size that characterizes the ...
226 views

### QoS implementation algorithm

I'm working on an application, that does IP routing and QoS. Today we have the QoS implemented, with 3 priorities (low, normal and high) and for each level we create a Queue and as soon as the ...
243 views

### Looking for a very memory-efficient way of finding exporting all relations in a family tree

Think of the question as a family tree, in the PS section I will explain what exactly it is but family tree is easier to imagine: so father, has kids, those kids may have more kids, those kids may ...
1k views

### Interview books on data structures, tree operations, algorithms and algorithms complexity, etc [closed]

I might be prompted for an interview at Microsoft and since I've got some time to study I'd like a suggestion on some books or sources covering questions and answers for a software engineer technical ...
2k views

### Preferring Python over C for Algorithmic Programming

I've been studying a bit of algorithms and have been looking at sites like SPOJ.pl TopCoder etc. I've seen that programmers prefer C or C++ usually for most algorithmic programming contests. Now ...
310 views

### What is required for a scope in an injection framework?

Working with libraries like Seam, Guice and Spring I have become accustomed to dealing with variables within a scope. These libraries give you a handful of scopes and allow you to define your own. ...
359 views

### Explanation of satellite data from a programmers perspective

I have started reading Part 2 of Introduction to Algorithms and in the section The structure of the data the author/authors says in the context of sorting a sequence of numbers: In practice, the ...
571 views

### Generating different combinations from a list of muscles

Suppose we have a model of a human muscular system containing the following muscles each within a specific muscle group: Arms Biceps Triceps Forearms Torso Front Abs Chest Shoulders Torso Back ...
1k views

### What does it mean by expected running time and average runnnig time of an algorithm?

Let's say we want to analyze running time of algorithms. Sometimes we say that we want to find the running time of an algorithm when the input size is n and for the worst possible case it is denote it ...
582 views

### I'm at a crossroads with programming and theory [closed]

I bought "Beginning C++ Through Game Programming" yesterday to start learning about C++ and programming. I'm going on hour 33, and I can't seem to put this book down. I was talking to a friend who's ...
263 views

### Allocation problem identification

I have a matrix. I have a list of people who have to occupy n1,n2,n3 etc cells, different number of cells in different rows. I have to place the people in the cells. Occupying the same cell across ...
110 views

### Efficient Summary calculation method or approach?

I have an object hierarchy with a number of leaf nodes that will contribute to summary values for the parent object (specifically: project cost and square footage). What's the most efficient way to ...
2k views

### What does it mean when we say that some function is polynomially bigger/smaller than some other function?

I was going over this video lecture on master theorem from Introduction to Algorithm and while explaining case A of the master theorem professor says that some function f(n) is polynomially smaller ...
716 views

### Please explain the statement that the function an+b belongs to O(n^2) and and Θ(n)?

Let's say I have a linear function f(n)= an+b, what is the best way to prove that this function belongs to O(n2) and Θ(n)? I do not need mathematical rigor here. I need a programmers answer. Some ...