9 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for ayeswarya

[CODE]struct PCB* handleProcessArrival_PP(struct PCB *processhead,struct PCB *processtail,struct PCB *currProcess,struct PCB *newProcess,int currTime){ if(currProcess==NULL){ newProcess->executionStartTime = currTime; newProcess->executionEndTime = currTime+newProcess->totalBurstTime; newProcess->remainingBurstTime = newProcess->totalBurstTime; if(newProcess->processID==processhead->processID){ processhead= newProcess->next; printf("processhead in case 1 %d \n",processhead->processID); } currProcess=newProcess; printf("***current process = new process%d \n",currProcess->processID); contents(processhead); return currProcess; //return processhead; } if (currProcess->processID !=0){ contents(processhead); if(currProcess->processPriority>newProcess->processPriority){//new …

Member Avatar for rubberman
-1
3K
Member Avatar for diafol

Hello All. Been playing around with some linked dropdowns. It seems to be a recurring theme here on DW, so I thought I'd offer this up as a possible solution or for discussion, to see how it could be improved. The premise for this set of linked dropdowns is that …

Member Avatar for diafol
5
941
Member Avatar for diafol

**// EDIT 2014-04-07 //** New version (1.0.3) posted at the [bottom](http://www.daniweb.com/web-development/php/code/476623/ajaxed-linked-dropdowns-select-fields-for-volatile-data#post2082327) Demo Page: http://demos.diafol.org/ajax-linked-dropdowns.php *********************************************** Hello All. Been playing around with more linked dropdowns (select form fields), following the code snippet posted for static-ish data [here](http://www.daniweb.com/web-development/php/code/475238/linked-dropdowns-select-fields-for-static-ish-data). The static-ish version is of limited use (or of no use!) if data in …

Member Avatar for diafol
3
1K
Member Avatar for lazylibran82
Member Avatar for mayankjoin
Member Avatar for vegaseat

This is an example of a singly linked list allowing you to enter a number of names and associated ages. The twist is that the names are inserted into the list in ascending order. When the list is displayed, it is already sorted by name. Note: This is not an …

Member Avatar for Ancient Dragon
1
451
Member Avatar for TrustyTony

Here is code, which you can play with before installing and using the [superior blist package from pypi](http://pypi.python.org/pypi/blist/). I did it as therapy after doing programming test answer using zillion of setters and getters. Motivation is basically to show why you should use properties after you need them and attribute …

0
311
Member Avatar for pce369

I wrote a linked list program in C++ which compiles and works well. But I have been told that a) I have to have two separate structs instead of one that contains both the info and the node; and, b) that I have to use two pointers instead of the …

Member Avatar for Labdabeta
0
427
Member Avatar for TrustyTony

Here unsystematic play with linked list structure Object Oriented style. If you have performance critical code, please do not use this but use the superb faster than list [URL="http://pypi.python.org/pypi/blist/"]blist module[/URL] (including sorted versions of main data structures). As OO newbie (though with some 30 years of other programming), I wanted …

0
208

The End.