15 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for FUTURECompEng

public void Enqueue(int value){ node end = endList.next; end.next=null; endList.data=value; endList.next=end; endList=end; Here is my code for an Enqueue method but when I run it mylist.Enqueue(12); It gives me an error. Is something wrong with my method or am I testing it incorrectly? Thanks.

Member Avatar for FUTURECompEng
0
293
Member Avatar for FUTURECompEng

Currently this method has a run time of O(N^2) and I am trying to get it to O(N). Any suggestion as to where I should start? public void removeAll(e removeNum) { node nodeToFind = this.find(removeNum); while(nodeToFind != null) { this.remove(nodeToFind); nodeToFind = this.find(removeNum); } } Thanks

Member Avatar for JamesCherrill
0
296
Member Avatar for FUTURECompEng

I am trying to input an int into the end of a singly linked list. I have already created the code to put a number at the end of the list but when I go to print it out, it only prints out (in my test class) the int that …

Member Avatar for jalpesh_007
0
303
Member Avatar for dushtu.bor

Please tell me why it gives me always zero value? [CODE]<?php $total =0; $memid = $_POST['username']; $leg = $_POST['leg']; mysql_connect ("host", "usr", "paswd") or die ('Error: ' .mysql_error()); mysql_select_db ("dbname"); function getTotalLeg($memid,$leg){ $sql="select $leg from `users` where `username`='$memid' "; $res=mysql_query($sql); $row=mysql_fetch_array($res); global $total; $total = $total+mysql_num_rows($res); if($row['$leg']!=''){ getTotalLeg ($row['$leg'],'lname'); getTotalLeg …

Member Avatar for dushtu.bor
0
168
Member Avatar for Rimojenkins

Hello. I am working on a data structures program that should be quite easy, but after programming in assembly language using mips, I forgot a little bit of C++ and can't remember how to do this. I've used my googlefu for at least 2 hours and still have this problem. …

Member Avatar for Rimojenkins
0
174
Member Avatar for borchu

Hello, I am asking about true syntax of the following:: I have a class name P and in header file (of this class) ------> [CODE] class P { public: P(); ~P(); void addItem(const int newItem); void deleteItem(const int Item); void showAll(); /** need to proper getter funct. of tail */ …

Member Avatar for borchu
0
236
Member Avatar for cool_zephyr

Hello there..i'm trying to implement a tree in C#..the basic node structure is give below [code] struct node { public int _x; public int _y; public int _cost; public node _parent; public pos(int i, int j,int cost,pos parent) { _x = i; _y = j; _cost = cst; _parent = …

Member Avatar for cool_zephyr
0
155
Member Avatar for AbEeR Q8

hi; I'm trying to program a circular link list with a head node , I have a problem with insert function . wanting to do it like this but with a head node >> [url]http://geeksforgeeks.org/wp-content/uploads/cll1.gif[/url] this is my function :: [CODE] struct node{ int data; node *next; node(int x,node *n=NULL){ …

Member Avatar for raptr_dflo
0
384
Member Avatar for corby

i have this code for adding a node after the previous node, but valgrind is saying that there is a memory leak of 16 bytes, can someone please help me identify where the leak is? i think i didnt assign a null pointer somewhere but im not sure exactly where …

0
115
Member Avatar for johnbo100

Hi All I am trying to get vb.net to select a single node by id. I then want get all of the childnodes within the id and place them in to textboxes. Please see code below: Xml doc [code] <Subject> <Items> <Item id="1"> <CustName>john</CustName> <Filename> </Filename> <StartDate> </StartDate> <FinishDate> </FinishDate> …

Member Avatar for johnbo100
0
5K
Member Avatar for lasl0w

Hello, I'm doing a full traversal of a binary search tree structure looking for a node by a field that is not the sort key. If the node i'm looking for is the root node, no problem. If it's any other node then the function has a Seg Fault. Anyone …

Member Avatar for lasl0w
0
197
Member Avatar for sbrohee

Dear all, I am completely lost and I don't see at all my mistake! I thought this would be a very easy step in the building of my classes. Thanks a lot for your help! In the context of graph theory, I have a class Node. As attribute of this …

Member Avatar for sbrohee
0
350
Member Avatar for blue6dImension

[CODE] private Node<T> addAt(Node<T> node, T value) { if (node == null) { // special case return new Node<T>(value, null); } else if (node.getNext() == null) { // other special case node.setNext(new Node<T>(value, null)); } else if (node.getstuff().getName().compareTo(value.getName()) > 0) { node.setNext(new Node<T>(value, node.getNext())); } else addAtEnd(node.getNext(), value); } return …

Member Avatar for bbman
0
168
Member Avatar for spursfan2110

Hi all! So our T.A. gave us a function to use in our programming assignment as follows: [code=php] struct node *delete_from_list(struct node *list, int examnum) { struct node *cur, *prev; for (cur = list, prev = NULL; cur != NULL && cur->examNumber != examnum; prev = cur, cur =cur ->next) …

Member Avatar for spursfan2110
0
2K
Member Avatar for P00dle

I want to remove the JOB node with JOBNAME "One" from the following file: <SETTINGS> <SYSTEM> <VERSION>3.1<VERSION> </SYSTEM> <JOB> <JOBNAME>One</JOBNAME> </JOB> <JOB> <JOBNAME>Two</JOBNAME> </JOB> </SETTING> The code that is supposed to remove it looks like this: [CODE]try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); Document doc = docBuilder.parse(new …

Member Avatar for P00dle
0
5K

The End.