Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to design and analysis of algorithms.
19
votes
7
answers
6k
views
Why do we use the number of compares to measure the time complexity when compare is quite ch...
With sorting or selection algorithms, for example, what if the number of comparisons can be O(n log n) or O(n), but then, other operations had to be O(n²) or O(n log n), then wouldn't the higher O() still …
2
votes
2
answers
141
views
What algorithm may be used to solve the re-assembly of shredded papers?
I was once given this question in an interview:
Suppose a piece of paper has 80 columns of alphabets with a fixed size font, and now the paper is shredded vertically, into 80 vertical pieces (so e …
1
vote
1
answer
58
views
What algorithm can solve the conversion engine problem?
I was once asked a question, given a series of units and their ratios, such as inch, cm, gram vs pound, and a lot of potentially cryptic units and ratios, such as A, B, C, D, ... if I am given n times …
0
votes
2
answers
50
views
Is destructuring a heap (taking down a heap) also O(n) like building a heap? If so, can the ...
If we can build up a heap with time O(n), can we take down a heap also by O(n)? (by delete-max repeatedly).
Intuitively, it may feel it is, because it is like the reverse of build it up.
(Building a …
0
votes
Is there a random shuffle algorithm using only true /false?
You actually can use true / false to simulate a Riffle Shuffle or Faro Shuffle:
Start with the deck of cards on the middle
Move half of the deck to the left, and half to the right
Get a boolean: if …