Need help finding a linear sorting algorithm [closed] - algorithm

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
Given a machine that can compute the kth smallest item of an Array A in 𝑂(βˆšπ‘›) time. Find a recursive function that can sort A in linear time corresponding to n which is the length of A.
First I tried to optimize some of the sorting algorithms I knew using this new property but the best I could do was O(n^3/2) and currently I'm wondering whether if it is possible or not.

Related

need help to identifying Sorting algorithm [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am a beginner in data structure . I have an assignment on "identifying sorting algorithm" . i have no idea how to do? help me to identify the sorting algorithm . i have attached my question.
assignment
Ok.I don't know if your question is 'legal' for this website but I try to explain to you:
Each bold Title (Algorithm1,Algorithm2, ecc.) represents a sequence of steps of 4 differents sorting algorithms. Each line represents the sequence that needs to be sorted.
In Algorithms 1 for example at step 0 (first line) the number 23 is bold. This means that the algorithm take that number because it isn't in the correct position,so at line 2 the element 23 is swapped with the element on the mid and the sequence is divided into 2 sub-sequences (see the highlines) and then the algorithm work on each of them in the same way....
I think the first can be a sort of Merge-sort

EV function for 2048 video game [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What is the best admissible heuristic function for 2048 video game? Please give example of initial state and next state and how to compute the value of the evaluation function?
It is hard (if not impossible) to label an heuristic as "best".
One idea I have in mind is evaluate the heuristic for the current state as the maximum value of all the tiles at this state. And then, that with the higher value is supposed to be better ("closer") to the goal.
And it is admissible because it is never would be lower than the real value (that would mean that the current maximum is not the maximum, and that is not possible).
Probably, you can expand this heuristic with something as: given the current maximum position, is one of its (up to) 4 neighbours of the same value so they can sum up? But that requires a bit more of sophistication in order to keep it admissible.

Why is it called topological sort? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
From where does it derive its meaning:
1) Topography, as in region, geography etc.
OR
2) From one of its mathematical meanings: the set of all open subsets of a topological space(http://www.merriam-webster.com/dictionary/topology)
Thanks,
Chris.
P.S: Please do not mention the meaning related to computer science from the dictionary as that is what I am trying to figure out here.
Probably first use of term "Topological sorting" is from Kahn, Arthur B. (1962), "Topological sorting of large networks". Term "Topological sorting" derives from "topological ordering", which is defined in this article:
A list in topological order has a special property. Simply expressed:
proceeding from element to element along any path in the network, one
passes through the list in one direction only
So it would be "topological" in mathematical meaning, but not strictly the one you mentioned. It would be "topological" rather in the sense of Topological Graph Theory

Optimal Seat Allocation Algorithm [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am looking for an optimal seat allocation algorithm, such that for example, if i have a cinema with capacity 100, and n groups of people, i want to choose the right groups that will fill in as maximum seats as possible.
The only thing that will work is brute force, but I'm sure there must be cleverer ways to do that. Any ideas?
This is a special case of the Knapsack problem known as the Subset Sum problem. There is a lot of work already done on this so the wiki article is a good jumping off point discussing many possible algorithms. The correct choice in algorithm will depend on the sort of data you’re operating on.

Maximum no of overlaps of all time intervals [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Given a set of time intervals , how to find the find the maximum no of overlaps . Is there any algorithm which solves the given problem with time complexity O(n log n ) or O(n)??
example : (6:00-9:30),(9:00-12:30),(10:00-10:30), (12:00-14:30), (11:00-13:30).The answer is 3
Sort the values using quick sort -- O(nlogn) time.
6:00(+)
9:30(-)
9:00(+)
12:30(-)
10:00(+)
10:30(-)
12:14:30(Dude wut?) --> Im going to assume you meant 12:00(+) ,14:30(-)
11:00(+)
13:30(-)
Becomes
6:00(+)
9:00(+)
9:30(-)
10:00(+)
10:30(-)
11:00(+)
12:00(+)
12:30(-)
13:30(-)
14:30(-)
Iterate through the list incrementing for every plus and decrementing for every minus, record the max value found. This takes O(n) time
Total time O(nlogn + n) = O(nlogn)

Resources