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
Related
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.
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 5 years ago.
Improve this question
A number is said to be cool number when the sum of its right digits is equal to the sum of its left digits. Can you please help me in building the logic for this question as I cannot build any logic for that
Define what are left and right digits
Parse each digit on right, sum them
Parse each digit on left, sum them
check the sums are equal
If you have specific questions on each we can help, but we won't do your homework for you.
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'm looking for an efficient way to map a N integers to [1,N].
The N integers are actually entries of a sorted array A with no redundancies, and my goal is to be able to simply access the index of every entry of the array.
Example :
For a given array A of integers, sorted and without redundancies, but with gaps and possibly very large numbers (you could have 1000 integers ranging from 25 to 10^6), I need a way of finding the index of every entry in an efficient way. For example if A[15] = 1546, I need to be able to do index(1546) = 15.
My problem is that I need to do this in Fortran, and as far as I know, there are no real hash table libraries.
I think, you can use a binary search for solve your problem. It is simple for code.
Look this page [Binary search in array issue using Fortran
Using binary search you get the inverse index of the given number.
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 8 years ago.
Improve this question
Is there an O(n)-time algorithm to find the largest, second-largest, fourth-largest, ..., 2kth-largest, etc. elements in an array?
Since this looks like a homework question, I won't give a full answer. However, here are a few helpful hints:
Do you know how to find the kth largest element in an array in time O(n)? If not, you probably need to look this up before you're going to make any progress.
1 + 2 + 4 + 8 + ... + 2log n = 2n - 1, which is O(n).
Use the algorithm from part (1) on intelligently-chosen arrays. The summation from (2) will help you prove that you have the runtime bound you need.
Hope this helps!
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
You may have heard that last year it was proven that the smallest number of starting clues for a Sudoku game, guaranteeing a unique solution, is 17.
An example is shown below.
I am interested in the opposite:
What is the largest number of starting clues for a Sudoku game that does not guarantee a unique solution?
I have a lower bound of 63. This is if you take a solved Sudoku and delete every instance of two numbers (i.e., delete all the 1s and 2s). Alternatively, you could delete the top two rows, again yielding two different solutions for 63 starting clues.
Can you do better than 63, or is 63 is the highest?