Recent content by abacus
-
A
Randomized Quick Sort: Code & Run Time
I don't know how to use a debugger as for the example you posted in only shows whatever I had inputed randQuickSort(k, value,value)- abacus
- Post #20
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
I was thinking 0 and 9, but that had the same effect.- abacus
- Post #18
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
I thought that would somehow call the positions of the left and right.- abacus
- Post #16
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
I think I'm getting close, now there are no memory errors and it outputs something, but it outputs the order I inputted. #include <iostream> using namespace std; void quickSort(int numbers[], int array_size); void randQuickSort(int numbers[], int left, int right); int main() {...- abacus
- Post #14
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
Sorry, I thought that calling on the values would have indicated the positions. How would I call on the positions l, r or would I need to declare the two ints in main first? Right now I seem to compile without error, some warnings, and there seems to be a memory leak. #include...- abacus
- Post #12
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
randQuickSort(k, k[0], k[9]); would saying k[0](left) and k[9] (right) signify their positions in the array? The error I keep getting is randQuickSort identifier not found.- abacus
- Post #10
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
Yeah I guess it's not working. *updated below- abacus
- Post #8
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
so something like this? void RandQuickSort(int Array[], int l, int r) { int piv=l+(rand()%(r-1+1); swap(Array[1],Array[piv]); int i = l+1; int j = r; while (1) { while(Array[i] <= Array[1] && i<r) ++i; while (Array[j] <= Array[l] && j>l) –-j; if (i >=j) {...- abacus
- Post #6
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
so I can just set Object pivot = rand(); ?- abacus
- Post #3
- Forum: Computing and Technology
-
A
Randomized Quick Sort: Code & Run Time
My textbook has the following code as a Quick Sort. It also discusses a randomized quick sort which should have a faster run time, but doesn't show the code for it. What would the code be like? Is only the pivot changed? void quickSortStep(Sequence& S, int leftBound, int rightBound) {...- abacus
- Thread
- Sort
- Replies: 21
- Forum: Computing and Technology
-
A
Insert & Remove Functions for Doubly Linked List
Thanks for the tip maverick280857- abacus
- Post #14
- Forum: Introductory Physics Homework Help
-
A
Insert & Remove Functions for Doubly Linked List
Thanks I got it to work in a way.- abacus
- Post #11
- Forum: Introductory Physics Homework Help
-
A
Insert & Remove Functions for Doubly Linked List
why? What steps am I missing? I just want it to insert at the beginning.- abacus
- Post #9
- Forum: Introductory Physics Homework Help
-
A
Insert & Remove Functions for Doubly Linked List
Thanks mav and brian, So far I got the insert to work I believe. void insert(cNode*& head, int n) { cNode *newNode; newNode = new cNode; newNode->data = n; newNode->next = head; head = newNode; } The remove function is a bit tricky since I want whatever I input as my c-th node...- abacus
- Post #7
- Forum: Introductory Physics Homework Help
-
A
Insert & Remove Functions for Doubly Linked List
I'm using a struct. Yeah I believe I made a typo for the remove function i didn't want to pass head to tail, it's head to node. for Insert I had this, but I'm getting errors:- abacus
- Post #3
- Forum: Introductory Physics Homework Help