All Questions
19 questions
4
votes
4
answers
1k
views
Quick Sort Done Lucidly
I've been away from Programming and the Tech Industry for sometime. I thought I'd look at and try some of the older basic stuff. I bushed up to QuickSort and found most existing implementations of it, ...
2
votes
1
answer
361
views
Sorting visualizer using Java Swing
I programmed a little sorting visualizer a while back and I have been meaning to get some feedback on the overall implementation and on what I could do better to have cleaner code or a "best ...
0
votes
1
answer
61
views
Quicksort Invariant and steps to determine correcteness
I am having trouble with applying to 3 steps needed to proof correctness, most likely because I did not formally study CS or Mathematics and am still learning about loop and class invariants. The ...
6
votes
3
answers
187
views
Class for managing a list of scores (game development)
For my game that I'm writing, I need, among other things, a data structure for storing best values. For this purpose, I tried to write a class that meets the most general needs, and yet does not seem ...
3
votes
1
answer
803
views
Sorting an array of numbers in Java with an algorithm
This is pretty much one of my first programs that I have created in Java and I just wanted to ask if anyone sees some obvious errors or mistakes I made.
The purpose of this program is to sort numbers ...
7
votes
5
answers
3k
views
Sort an array of 0s, 1s and 2s in Java
Write a program to sort an array of 0's,1's and 2's in ascending
order.
Input:
The first line contains an integer 'T' denoting the total number of
test cases. In each test cases, First line is number ...
3
votes
3
answers
9k
views
Sorting integers in descending order
So, I coded a program which asks you the number of integers and the integers the user wants to sort in descending order. The program works but I feel like it is very inefficient. If I were to receive ...
0
votes
1
answer
580
views
Sort a stack using Java
This is my attempted solution to cracking the coding interview exercise 3.5. Looking for any feedback on coding style or the algorithm anywhere I can improve really.
The problem specification is as ...
2
votes
2
answers
691
views
Class name search algorithm
Here is a test task from a company, where I'd like to work eventually. I solved all they wanted to me to do, however failed to get an interview. I do not know what is wrong with my solution, because ...
7
votes
2
answers
391
views
Selection Sort algorithm in Java
I'm relatively young in Java, and am familiar with only the basics of the language, yet. I've started studying data structures, and I've made an attempt to create a solution for the selection sort ...
4
votes
5
answers
379
views
Sorting ArrayList
Here is the task:
Create several classes of flowers that extend abstract flower. all fields -- random.
make a bunch of 20 different flowers
calculate the price of the bunch
sort bunch ...
1
vote
2
answers
130
views
Possible sub-optimal selection sort
Why is this code "bad"? In all of the selection sort codes I am learning from, they do it much differently. I will learn the proper code from the book, but I would love to know why this particular ...
6
votes
2
answers
1k
views
Merge Sorting Lists
I'm fairly new to Java, arriving in the "future" from C and returning to type safety from Python. I'm looking for your suggestions to improve this code in the following areas:
Correctness - are there ...
12
votes
4
answers
43k
views
Merge Sort an integer array
I've implemented merge sort an integer array. Is it okay to use i,j,k as variable name for looping? Should I change them to more meaningful names? Overall, any further suggestions on this code?
...
2
votes
1
answer
1k
views
Insertion sorting an int array
I'd like to improve this Insertion sort code
...