Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > BOOK: Beginning Algorithms
|
BOOK: Beginning Algorithms
This is the forum to discuss the Wrox book Beginning Algorithms by Simon Harris, James Ross ; ISBN: 9780764596742
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Algorithms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 27th, 2013, 08:54 AM
Registered User
 
Join Date: Dec 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Methods for Inserting and Adding Values

On page 69 of this book, there is a method called getElement that assists with inserting values into a linked list.

The code is as follows:

Code:
1. private Element getElement(int index) {
2.     Element element = _headAndTail.getNext();
3.
4.     for (int i = index; i > 0; --i) {
5.          element = element.getNext();
6.     }
7.
8.     return element;
9. }
Could someone please explain in detail what each line of code is doing, particularly lines 2, 4 and 5?

New programmer here, any help will be gratefully appreciated.

Last edited by mo210; December 27th, 2013 at 09:00 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting values from other tables TheAndruu SQL Language 7 May 27th, 2007 10:47 AM
inserting values sspr SQL Server 2000 2 February 15th, 2006 03:20 PM
inserting values into a database RPG SEARCH ASP.NET 1.0 and 1.1 Basics 3 February 5th, 2005 07:56 PM
Methods - Returning Multiple Values? p_nut33 VB.NET 2002/2003 Basics 5 December 22nd, 2003 10:09 AM
inserting values error - Please help gtmm9 Classic ASP Databases 1 October 6th, 2003 11:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.