jan07's Profile
Reputation: 2
Apprentice
- Group:
- Active Members
- Active Posts:
- 69 (0.14 per day)
- Joined:
- 22-January 12
- Profile Views:
- 460
- Last Active:
Feb 21 2013 07:13 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: adding doubly linklists to an array
Posted 21 Feb 2013
Yeah you make a good point. I've thought about calling a new element marker like so:
int i = 0; DataRecord s = new DataRecord(f, l, id); data[i] = s; fNamel.insertFirst(f,i); lNamel.insertFirst(l,i); Idl.insertFirst(id,i); data[nElems]=//this is where im not quite sure how to implement the newly entered fName, lName, and Id into the first element of data[]? nElems++;
I think the method itself is working close to right but my variables are off. I'm not quite sure how to incorporate the new info into data[] on each call to add()? nElems is initialized outside of the add() method to 0. -
In Topic: nth smallest element
Posted 21 Nov 2012
I figured i loop over the whole array, catch the minimum, and then get rid of it twice leaving third minimum the new absolute minimum. -
In Topic: nth smallest element
Posted 20 Nov 2012
That didn't change anything -
In Topic: nth smallest element
Posted 20 Nov 2012
Thank you guys. Okay I keep getting closer and closer but for some reason i just cant finish. I have gotten to this point and it sometimes gives me the third smallest and sometimes it doesn't?
function min3() { inputString = document.form1.text1.value; var stringArray = inputString.split(','); for(var i=0; i<stringArray.length; i++) { var min1 = Math.min.apply(Math, stringArray); for(var j=1; j<3; j++) var index = stringArray.indexOf(String(min1)); stringArray.splice(index, 1); } document.form1.text2.value = "Min3 = " + min1; } -
In Topic: nth smallest element
Posted 14 Nov 2012
Thank you for your reply. I have gotten to this point now and my loop doesn't seem to be deleting the min number 3 times? I know its probably a little sloppy my intent with the loop is to cycle through array 2 times. Each time I define the min number and delete it leaving stringArray[0] the third minimum number. Somethings going wrong here i'm just not sure what?
function min1() { inputString = document.form1.text1.value; var stringArray = inputString.split(','); for(var i=0; i<stringArray.length; i++) var min1 = Math.min.apply(Math, stringArray); //var count = 0; for(var j=0; j<3; j++) { var index = stringArray.indexOf(min1); stringArray.splice(index, 1); //count ++; } document.form1.text2.value = "Min3 = " + stringArray[0]; }
My Information
- Member Title:
- D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
jan07 hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
jan07 has no profile comments yet. Why not say hello?