26 Topics

Member Avatar for
Member Avatar for brooklyn1991

Hello, everyone!:) I am new to Daniweb and I would like a little help in implementing Binomial Heap subroutines in C, especially insertion in Heap. For my application it is necessary to implement max-heaps(i.e., roots storing the maximum value) in stead of min-heaps(i.e., root storing minimum value) in ANSI C. …

Member Avatar for DGPickett
0
295
Member Avatar for Anil2447

Here is the code for [B][COLOR="Red"]Insertion Sort, Bubble Sort and Selection Sort[/COLOR][/B] [B]Insertion Sort[/B] [CODE] #include <stdio.h> main() { int i,j,key; int a[5]={5,2,3,4,1}; for(i=1;i<5;i++) { key=a[i]; while(i>0 && a[i-1]>key) { j=a[i]; a[i]=a[i-1]; a[i-1]=j; --i; } } int k; for(k=0;k<5;k++) {printf("%d ", a[k]);} printf("\n"); } [/CODE] [B]Bubble Sort[/B] [CODE] #include <stdio.h> …

Member Avatar for Talha_5
0
9K
Member Avatar for marcelmarcelmarcelmarcelmarcelmarcelmarcelmarcel

Hello, for a school assignment I was supposed to write an insertion sort algorithm for a doubly linked list. As the feedback system of this particular course is rather weak (actually non-existent) I would like to ask you for your honest opinion about how well this is implemented, what could …

Member Avatar for David W
0
2K
Member Avatar for daniela.valkanova

> The following letters are stored in an alphabet array: B, J, K, M, S, and Z. > Write and test a function named adlet(), which accepts the alphabet array and a new letter >as arguments, and then inserts the new letter in the correct alphabetical order in the array. …

Member Avatar for daniela.valkanova
0
268
Member Avatar for Praveen_10

#include <cstdlib> #include <ctime> #include <iostream> using namespace std; int findSmallestRemainingElement (int array[], int size, int index); void swap (int array[], int first_index, int second_index); void sort (int array[], int size) { for ( int i = 0; i < size; i++ ) { int index = findSmallestRemainingElement( array, size, …

Member Avatar for vmanes
0
313
Member Avatar for dougy83

Hi all, Does anyone know how to quickly (i.e. O(log n) time) insert items into a sorted list? I'd prefer an existing working function if available; I didn't see any appropriate ones in boost or stl. Some background: I'd like to keep a constant sized sorted list, and insert items …

Member Avatar for dougy83
0
13K
Member Avatar for kgizo

Hi I have data to upload to a Mysql database and I need to get the time taken for each row to be inserted so that I can pass that number through to a progress bar. I have alreay tried accomplishing this by determining the number of rows affetced by …

Member Avatar for diafol
0
389
Member Avatar for ariel930

Hi,I am having a hard time trying to do insertion sort on a singly link list containing single alphabets.I have spent hours doing this but still it wont work.Any help will be apprecited. Here is my code: # include <iostream> using namespace std; class node { public: char info; node …

Member Avatar for richieking
0
5K
Member Avatar for HankReardon

Hello, I have been having quite a bit of trouble with this one. Can someone please tell me how many swaps it would require to sort the following array? {2, 4, 6, 3, 7, 1} I tried putting my counter in a couple of places and neither one of them …

Member Avatar for HankReardon
0
2K
Member Avatar for Hey90

I have been told it is good to overload the stream extraction operator to load data from a file. Would I simple use this in my class: friend ifstream &operator>>( ifstream &input, Class &C ) { input >> C.variable1 >> C.variable2 >> C.variable3; return input; } What are the advantages …

Member Avatar for deceptikon
0
430
Member Avatar for khair.ullah

Hello dear ALL I am working with a form in vb.net which have the follwing attribute i.e BOOK TITLE(text box) , CATEGORY NAME(combo box) ,YEAR PUBLISHED(t.box) and SAVE button .the CATEGORY combo pickup data from CATEGORY TABLE on cat_name . on back end (SQL SERVER) there are two tbl i.e …

Member Avatar for khair.ullah
0
208
Member Avatar for Yoink

Hi, I had an assignment where we had to fox a program and get it working correctly. I fixed 99% of the problems and the program runs correct. The only thing that is wrong is my insertionSort() method. It runs correctly, but in the wrong order. Currently its listing names …

Member Avatar for Yoink
0
3K
Member Avatar for Rishabh876

so i was trying to make a binary tree program. just inserting and deleteing. some how i messed up. i think insertion is ok till level 1 after that stays on level 1 only. also the function to delete the whole tree is not working. it only deletes node at …

Member Avatar for Rishabh876
0
311
Member Avatar for arjuna_wahid

Hello there, I am new to C++. I have a task from school to make simple sorting program using Insertion Sort with a linked list. I would like to have comment, feedback, and correction of my code below. #include <iostream> using namespace std; struct Sort{ int value; Sort *next; // …

Member Avatar for rubberman
0
1K
Member Avatar for blakehouston

Does dynamic keyword insertion on ads and landing pages guarantees high quality score? How can it generate positive effects on conversions?

Member Avatar for PrimeOutsourcin
0
223
Member Avatar for shibu2all

void insertion_sort(int *a, int n) { int for(i=1;i<n;i++) { value=a[i]; for(j=i;j>0 && value<a[j-1];j--) a[j]=a[j-1]; a[j]=value; } } can anyone pls explain me the flow of this code... i am having confusion in understanding the flow..

Member Avatar for TrustyTony
0
225
Member Avatar for cryonize

I have a bit a of a problem because I have no idea what's going on in my code. Could someone guide me with this? **It has to swap the nodes themselves. ** #include <iostream> #include <iomanip> using namespace std; typedef struct node { int DATA; node *NEXT; }; node …

Member Avatar for raptr_dflo
0
957
Member Avatar for Smartflight

Hi, I'm learning C/C++ at school and we have our vacations; thought I might do some programs on my own. I've landed at trouble with sorting numbers in a 1-D array at the time of insertion. It seems to work up to a certain point, after which it fails to …

Member Avatar for Smartflight
0
352
Member Avatar for challarao

I wrote this program for insertion sort.I compiled the source file in xubuntu terminal.But when I try to run a.out executable....terminal showing "segmentation fault".I don't about segmentation fault..when segmentation fault occurs...what is the thing in the source file that is causing segmentation fault... Thanks in advance...... [CODE]#include<stdio.h> main(){ int i,j,n,key; …

Member Avatar for challarao
0
365
Member Avatar for virtue

Hi, I wrote a program that inserts nodes into a linked list in descending order.But whenever I test my code with numbers 12,14,13,19,7 in this order.Whenever I entered 7 I took 7 is already in the list.But as easily seen 7 is not in the list before I inserted.After give …

Member Avatar for sourabh17
0
130
Member Avatar for Momerath

The past few days I've posted some sorting routines customized to the tasks they were required to solve. Since I have a bunch of different sorting routines already coded, I decided to post them. Please note that some of these sorts are fast, but not a single one is as …

Member Avatar for Momerath
3
818
Member Avatar for genext.brite

I'm using Datagridview in Windows application in C#. I've bound the datagridview with a table.Now on run time when the user inserts new row and presses up or down button,that row should automatically be inserted into database and if its not a new row then nothing should happen. Some1 suggested …

0
98
Member Avatar for StaffanB

Is there a way to programmatically set the insert point in a multiline richTextbox? Example: I have a (almost) free format message where the reciever is expected to enter his own information at certain points (marked with a special char-sequence), before the message is processed further. A richTextbox.Find will find …

Member Avatar for nick.crane
0
153
Member Avatar for Roy_Valentine

Can anyone help me fix this problem I have with my code. I am supposed to be writing a Binary Insertion Sort method that calls a binary search method. I have code that is working for in order integers, when tested on reverse order integers it works except it places …

0
116
Member Avatar for mertserimer

the inputs are these computer 21 sabanci 4 sabanci 6 university 6 university 12 computer 17 university 3 computer 9 computer 6 sabanci 2 university 9 problem occurs at third line when the input name1 is equal with the previous input name1. Really thx for helping. Sorry for mess. #include …

Member Avatar for mrnutty
0
158
Member Avatar for rhoit

I was trying to Compare the 5 Sorting Algorithms using 4 test cases. [U]Sorting Algorithms[/U] [LIST=1] [*]Selection Sort [*]Insertion Sort [*]Bubble Sort [*]Quick Sort [*]Merge Sort [/LIST] [U]Test cases[/U] [LIST=1] [*][URL="http://the.nube.googlepages.com/Sort.Analysisplot1.svg"]Random Data [/URL](completed) [*]Reverse Sorted Data (completed) [*]Almost Sorted Data (can't generate Data) [*]Highly Repetitive Data (can't generate Data) [/LIST] …

Member Avatar for rhoit
1
859

The End.