-
Singly-Linked list structure
Hi All
I am beginner in Java and this is my first post.
Please could you help me with this .
I need to implement a basic singly-linked list structure as a class. also it should allow
addition and deletion of single element in the linked list at a specified position i. we can assume each element is represented using the int primitive data type.
I would be very great full if you point me some sample programs like i described
-
Re: Singly-Linked list structure
Do you have any code that you are having problems with?
If so, post the code and ask questions about your problems.
-
Re: Singly-Linked list structure
How can I get a link list to print out in an array? Any ideas?
-
Re: Singly-Linked list structure
Can you explain what you are trying to do?
"print out in an array" makes no sense to me.
Do you want to extract nodes from a linked list and store them in an array?
-
Re: Singly-Linked list structure
Sorry to be a pain,
yeap, extract nodes from a linked list and store them in an array
-
Re: Singly-Linked list structure
Use the linked list class's methods to get the nodes one by one and assign them to an array slot as you get them.
-
Re: Singly-Linked list structure
is that ok if PM you my code?
-
Re: Singly-Linked list structure
I don't do any work out of the public. If you want help you'll have to post code here with your questions.
If you can isolate a particular problem to a small program that will help.
-
Re: Singly-Linked list structure
no thats fine, just didn't wanted to make a mess ))
public void insert(int x){
if(start==null){
start=new Node(x,start);
}
if(start!=null){
Node temp=start;
while(temp.next!=null){
temp=temp.next;
}
temp.next=new Node(x);
This is what I'm using to insert a node,
But how do I insert a strand
-
Re: Singly-Linked list structure
Quote:
But how do I insert a strand
By strand do you mean another linked list?
Change the links to point to the front of the new list and change the end of the new list to be back into the original list.
Draw it on a piece of paper if you need to see what I'm talking about.
-
Re: Singly-Linked list structure
-
Re: Singly-Linked list structure
Please explain you question. I don't understand what you are asking.
-
1 Attachment(s)
Re: Singly-Linked list structure
I need to implement, crossover phenomenon. given 2 dan strands and an index i, d strands should cross-over so that d 1st i nucleotides of the 1st strand r unchanged, but d remainder is replaced with d nucleotides from d position i+1 go d 2nd strand. equally, d first i nucleotides of d 2nd strand should be unchanged, but d remainder of the 2nd strand. for ex, if d initial strands r:
(on the picture)
Attachment 1098
thank you very much and I do apologise for my unclear questions
-
Re: Singly-Linked list structure
-
Re: Singly-Linked list structure
thats my full question, is that make sense :confused:
-
Re: Singly-Linked list structure
You'll have to translate from the jargon you used in post#13 to something related to java programming.
-
Re: Singly-Linked list structure
Quote:
Originally Posted by
Norm
You'll have to translate from the jargon you used in post#13 to something related to java programming.
what u mean jargon
-
Re: Singly-Linked list structure
jar·gon (järgn)
1. Nonsensical, incoherent, or meaningless talk.
2. A hybrid language or dialect; a pidgin.
3. The specialized or technical language of a trade, profession, or similar group. See Synonyms at dialect.
4. Speech or writing having unusual or pretentious vocabulary, convoluted phrasing, and vague meaning.
-
Re: Singly-Linked list structure
cossover phenomenon. given 2 dan strands
d nucleotides from d position i+1 go d 2nd strand.
d first i nucleotides of d 2nd strand
None of that has any meaing for me.
#3 in post#18
-
Re: Singly-Linked list structure
i know what does jargon means i asked which words unclear
-
Re: Singly-Linked list structure
Quote:
please tell me if there is anything wrong with my code
If you want anyone to test your code, you need to post a complete program that compiles and executes.
A small program that shows the problem without any other stuff that is not related to the problem.
-
Re: Singly-Linked list structure
Quote:
Originally Posted by
Norm
cossover phenomenon. given 2 dan strands
d nucleotides from d position i+1 go d 2nd strand.
d first i nucleotides of d 2nd strand
None of that has any meaing for me.
#3 in post#18
given two DNA strands(thread)
the nucleotides (element) from the position i+1 of the second strand(thread)
-
Re: Singly-Linked list structure
I'll let you do the translating to programming language from your project's terminology(jargon)
Do you have a java programming question?
-
Re: Singly-Linked list structure
Quote:
Originally Posted by
Norm
I'll let you do the translating to programming language from your project's terminology(jargon)
Do you have a java programming question?
sorry Norm, that is exactly how on paper
-
Re: Singly-Linked list structure
Now it needs to be translated to programming terms. Computers use bits and bytes.
Programs work with variables and memory contents.