All Questions
15 questions
3
votes
2
answers
222
views
Counting duplicate elements in two sorted arrays
I've been working on an assignment that involves optimizing a duplicate finding algorithm for sorted arrays, and I'd like to get your thoughts on the implementation. Here's the code I've come up with:
...
1
vote
1
answer
270
views
Find Kth Element in the merged two sorted arrays?
We have been given two sorted arrays and a number K . We have to merge the two sorted arrays in the sorted manner and return the element at the Kth position.
My approach is to use two variables ...
3
votes
1
answer
1k
views
Quicksort using Lomuto partition scheme in C
This is my implementation of the divide-and-conquer Quicksort algorithm using the Lomuto partition scheme in C. This is part of a personal project and I'm following Linus Torvalds's coding style.
<...
0
votes
3
answers
1k
views
sorting vector of pair in efficient way
I'm trying to solve the sorting problem but I always get TLE(Time Limit Exceeded/ 1s) so... can you guys suggest a more efficient way to solve this problem?
(i can't link the exercise because it is on ...
3
votes
1
answer
148
views
Counting sort in C, revised
This is a revised follow-up to this question.
I have implemented most of the suggestions in the accepted answer. I am interested to see what I could improve in my code and what I could do to make it ...
3
votes
2
answers
1k
views
Merge the two sorted array of numbers into single array
I have written a code were I pass two sorted array of numbers from command line, and out is one array with numbers sorted.
the code is as follows,
...
4
votes
1
answer
1k
views
Repeated comparison of sorted subarrays
This question is from a recently concluded competition on Codechef.
You are given an array A of size n, and there are ...
2
votes
2
answers
496
views
Merge sort implementation using divide-and-conquer
I was told in an interview to write a program for implementing merge sort on the concept of divide-and-conquer.
...
2
votes
1
answer
103
views
If given two sorted arrays where first containing -1, merge into one sorted array
If given two arrays
arrayOne = [3,6,-1,11,15,-1,32,34,-1,42,-1]
arrayTwo = [1,10,17,56]
Both the array's are sorted
but array1 consists -1 in between the ...
1
vote
2
answers
823
views
Merging K Sorted Arrays
My aim is to merge k different sorted array with unique elements and I want a code review about it, here is my code below which is written in java;
...
6
votes
3
answers
2k
views
Bubble Sort in Objective-C
Following is Objective-C method implementation I did for one of the most simplest sorting algorithms, Bubble Sort to sort an array of integers.
Note:- I have defined it as a static method in the ...
5
votes
1
answer
2k
views
C# Sorting array without using the bubble sort
I'm a beginner and like to experiment new things so today I tried to implement sorting method for an array without using any Sort and the actual challenge was to do ...
6
votes
2
answers
15k
views
Sort array of objects with hierarchy by hierarchy and name
I have an array of nested objects:
...
2
votes
2
answers
15k
views
Sorting dates (DD/MM/YYYY) with insertion sort [closed]
I'm having troubles with a coding problem. Yes, I need to write a C++ program which sorts dates. I've tried several methods. Using 2D arrays and now parallel arrays.
The problem I have with my ...
4
votes
1
answer
6k
views
Quicksort using pointers
As an exercise, I've written quicksort algorithm in C using pointers. Please comment and help me find the cases where it breaks (if any).
...